Skip to main content
LBARB.1
Associate
August 2, 2022
Question

Issue with STM32F302CBT6 I2C and 24LC512 EEPROM

  • August 2, 2022
  • 5 replies
  • 1522 views

..

This topic has been closed for replies.

5 replies

LBARB.1
LBARB.1Author
Associate
August 2, 2022

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.

Tesla DeLorean
Guru
August 2, 2022

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
LBARB.1
LBARB.1Author
Associate
August 2, 2022

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 ?

LBARB.1
LBARB.1Author
Associate
August 2, 2022

.