2023-01-03 08:21 PM
Chipmodel : STM32L431RBTx
I use M24C04-WDW6TP EEPROM on I2C line and read it using HAL_I2C_Mem_Read() function.
In normal condition, HAL_I2C_Mem_Read() works well. But After download binary to MCU using ST-Link, 1 case in 1000 times try, HAL_I2C_Mem_Read() return error and fail, or retrun success but readout value is invalid.
In in comparison with J-link instead of ST-Link, no read error occurred. And with simple On/Off test, no error occurred too.
Have you have any similar case like as my?
2023-01-03 10:02 PM
If you stops (to download new binary) MCU somewhere in I2C communication, your slave device can be stucked and wait to complete previous I2C sequence ... and blocks you.
2023-01-04 05:44 PM
Is MX_I2C1_Init() which called STM32 FW inittal stage has no effect to reset I2C block? or insufficient?
How to secure I2C init when ST-Link download?
2023-01-04 06:52 PM
The usual slaves don't reset when the mcu does, and Have you checked bith sda and scl are high before even asking to generate a start bit? If not, do you resync the bus with 9 or 18 stop bits bit bang generated ? Rugged I2C is a brainer.
2023-01-04 07:48 PM
> with J-link instead of ST-Link, no read error occurred
That's why J-links are so expensive ; )