I2C Master - strange behaviour (Busy, HAL error)
Hello,
I have a problem with the I2C communication on my STM32F405. The F4 is running in master mode and has 3 identical sensor connected to I2C1, I2C2 and I2C3. I want to read from the sensors "parallel" 3 bytes with the HAL_I2C_Master_Receive_IT function and a frequency of 1kHz (bus frequency is 400kHz).
My problem is, that this communication seems to be extremely unreliable. So communication is sometimes running for several minutes, but sometimes the communication stucks directly after the first reading. What I see on the scope is that SCL is going low and remains low and I return from the Master_Receive_IT function with a HAL Busy. Strange thing is, that this often happens to all I2C channels simulatneously. And currently I see no way how to recover from this state. I tried e.g. a __HAL_RCC_I2C2_FORCE_RESET(); followed by a __HAL_RCC_I2C2_RELEASE_RESET(); that releases the SCL line, but I get in the same error direct when trying to read the sensor again. So my questions are:
- why does this happen? I reading 3 I2C in parallel to much? Do I get a problem with the interupts?
- how I can get out of the busy problem? Is there any elegant way out?
Thanks and best regards!
