I found when running release mode code from ROM (including the 'linked' rom.bin) that one of the two I2C pins wasn't being set up correctly - SDA was being set as an input rather than as an I2C pin.
I wrote a little checking routine which I called from various places, and which rectified the problem. This only occurs in 'release' mode.
void checkI2Cport(char *place, int resolve)
unsigned long temp0;
unsigned long temp1;
unsigned long temp2;
unsigned long temp3;
char status = "OK";
#define ME9210_CONTROL_0 ((unsigned long volatile *)(NA_GPIO_CONFIG_BASE_ADDRESS))
#define ME9210_CONTROL_1 ((unsigned long volatile *)(NA_GPIO_CONFIG_BASE_ADDRESS+4))
#define ME9210_CONTROL_2 ((unsigned long volatile *)(NA_GPIO_CONFIG_BASE_ADDRESS+
#define ME9210_CONTROL_3 ((unsigned long volatile *)(NA_GPIO_CONFIG_BASE_ADDRESS+0xc))
temp0 = *ME9210_CONTROL_0; // Config 2 register.
temp1 = *ME9210_CONTROL_1; // Config 3 register.
temp2 = *ME9210_CONTROL_2; // Config 2 register.
temp3 = *ME9210_CONTROL_3; // Config 3 register.
if ((temp2 & 0x0ff00) != 0x0800)
printf("%s: %08X: Config registers 0: %08X, 1: %08X 2: %08X, 3: %08X - %s\n", place, ME9210_CONTROL_0, temp0, temp1, temp2, temp3, status);
if (resolve && ((temp2 & 0x0ff00) != 0x0800))
printf("Reconfiguring control 2\n");
temp2 = (temp2 & ~0x0ff00) | 0x0800;
*ME9210_CONTROL_2 = temp2;
I found this last December - haven't checked properly whether any of the subsequent patches fixed it, but according to my debug flags its not fixed.
I've also found that the I2C sometimes fails to restart properly - if running in debugger, or if the ROM code is rebooted. Not ascertained the reason yet - the 'slaves' are custom-coded processors rather than I2C peripherals, so could also be a problem there.
Message was edited by: steved