AnsweredAssumed Answered

How to clear HAL_BUSY situation for I2C

Question asked by stokic.srdjan on Dec 22, 2016
Latest reply on Dec 22, 2016 by Nor Sch



On my board I have 2 STM32 processors which communicate to each other over I2C. One is always a master and the other one is slave.


The slave prepares some data, and then I do:


and wait for command from the master MCU. Once I receive the command I preprare the data and perform



This works fine except in the case when master doesn't read the data back. I might get an interrupt where I need to communicate to some other device on the bus, for example.


The slave gets stuck in the Slave transmit routine waiting for the master to read the data but the bigger problem is that the I2C bus is now blocked. I have other devices connected to the same bus, and when the master tries to perform write I always get HAL_BUSY.


How can I get out of this situation? Reseting the master MCU unblocks the i2c bus, which means that the slave is not locking it, but it's the master. What's the correct procedure that I need to follow in this case?


Thank you.