F411: how to handle I2C Errors
I am using the I2C code in STM32Cube_FW_F4_V1.26.0\Projects\STM32F411E-Discovery\Examples\I2C\I2C_TwoBoards_ComPolling as base to write my own I2C firmware.
I would say the HAL library in stm32f4xx_hal_i2c.c is quite useful and covers all I2C communication cases. However, there is not much about how to recover from an I2C error.
In the I2C_TwoBoards_ComPolling sample, if there is I2C error, error handler does nothing and MCU just hangs.
So far in my application, I run into two I2C errors: AF and TIMEOUT.
- I wonder in those two cases how I can recover I2C communication without software reset I2C.
- For the worst case, if I want to reset, what are the proper steps? Disable I2C and do Init again?
BTW, I am using F411.
