does anyone else have problems with I2C driver for NS9210?
On ESP 7.3 we had huge issues, including totally wrong speeds (2MHz?!) and I2C working only when run with JTAG. We solved this by supplying 0xFF as speed mode, and overloading rom.bin with ESP version (one delivered with module didn’t work).
This week we bought ESP 7.4 upgrade, with hope lot of those issues will be solved. Well, speeds finally do work properly. But I2C works only when application is run using JTAG, when booted from Flash I see no I2C activity at all on pins with oscilloscope.
Now, probably issue we had before had to do with 7.4 rom.bin being loaded in factory?
I checked CCR, RSR and PWR registers on JTAG/rom.bin startups, everything seems to be fine (same values). Now, what else can be wrong?!
This has nothing to do with specific module - tried with many.
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[10] = “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+8)) #define ME9210_CONTROL_3 ((unsigned long volatile *)(NA_GPIO_CONFIG_BASE_ADDRESS+0xc))
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.
This is actually tied to the recovery portion of the boot loader. By default it sets up GPIO 9 and 13 on the Connect ME 9210 as GPIO inputs (see customizeIsImageDownloadForced() in customizeBootloader.c) to check if they’re being shorted to ground. The problem is, it never switches them back to their previous modes.
My understanding is that Digi has just released a patch for this that’s available through Package Manager as well.
On a quick look the problem appears to be the same (although I’ve not investigated in detail since I updated to 7.4.2).
I call the routine I listed above, which sets up the SDA pin correctly if it isn’t, and that’s fixed the problem.