cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with STM32F302CBT6 I2C and 24LC512 EEPROM

LBARB.1
Associate II
 
5 REPLIES 5
LBARB.1
Associate II

Hi folks !

I'm working with a STM32F302 MCU and I'm currently getting trouble with I2C to store data on 24LC512 EEPROM.

I can store and recall data once, it works fine. But when I call the HAL_I2C_Mem_Write function twice or more it only work for the first data and not for the others. When I scope this, I've got all the 4 bytes ( 1 control byte + 2 byte for the memory address + data) of the first transmission and I have only 1byte + 2 more bits for the next transmission and it stops...

Moreover, when I run the program in debug mode there no problem, all data are well stored...

What a weird behaviour ! Anyone has an idea ?

PS : the HAL_I2C_Mem_Read() function works well even with multiple queued calls.

Thanks

Leo B.

Perhaps there are expectations on you waiting or checking status to ensure the write operation has completed? ​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
LBARB.1
Associate II

.

I already tried adding a delay between transmissions and checking the i2c busy flag but it did not fix the problem.

And how you you explain the second transmission start and stop midway ?

Ok ! The datasheet says to wait at least 5ms between two transmissions, (which is a lot). Here was the problem !