I2CEE Wrong Working: Spend Too Much Time Initing

I’m using mbed studio with mbed os 6.11.0, and running a test program of I2CEEBlockDevice with mbed LPC1768 board and 24C32 external I2C flash. I just copied the sample program from I2CEEBlockDevice.h, and modifide a phrase to I2CEEBlockDevice i2cee(p28, p27, 0xa0, 8*4096);, and added more printf phrases and a LED. As for the IC chip, I connected pin 5 and 6 (SDA, SCL) to p28 and p27, connected pin 4 and 8 (GND, VCC) to GND and VOUT, and remained A0, A1 and A2 floating.

However, it doesn’t work as I excepted. It was noticed that it took 7 mins 15 seconds to run the i2cee.init(); phrase. I’m not sure whether there is something wrong since this is my first time using a storage chip. Can anyone help me? Thanks.

Hi,

The 24C32 is 32k-bits EEPROM. The 4th parameter for the I2CEEBlockDevice constructor should be size of the device in bytes (not bits).

Hi, MACRUM,

Thanks for replying. I’ve modified that number to 4096, but sadly it seems not helping.

Maybe the firmware on your LPC1768 is out of date? Check e.g. here. I’ve seen this cause timers and things to get messed up.

Thanks for replying. I tried NUCLEO-L432KC and NUCLEO-F767ZI, and this reduced the time to approximately 6min. Maybe this could be a part of this problem, there are still some issues.

Hi,

I just created simple example project here. You can import it by Mbed Studio. I tested this with NUCLEO_F767ZI board with ci-test-shield board (has I2C connected AT24LC256 device).
The test run very quickly (no 6min for init).

Maybe you can check your hardware? e.g. Pull-up registers for both SDA and SCL etc.
Or, connect A0, A1 and A2 to GND.

Hi, MACRUM,

Thanks for replying. I knew that the long-time-initing was caused by poor connection on I2C line (which would be the same if the component was removed), and this question has beed solved. Thanks for your suggestion on checking hardware.

However, when I’m running your codes (of course 32*1024 is replaced by 4*1024), the i2cee read size, program size, and erase size are all 1. In this case, when I read the chip on my computer, only the letter “H” is written. It is true that I can directly make the buffer string what I want and force to write it, I’m wondering that is there any solution on this new issue.

Hi,

when I’m running your codes (of course 32*1024 is replaced by 4*1024 ), the i2cee read size, program size, and erase size are all 1.

I confirmed that I got same result. The implementation somehow fixed 1 value for these functions (I have no idea for this).

I update my example here, so you can try.