2017-10-02 03:53 PM
Hi, I don't know if anyone has ever encountered the same issue I am encountering. When I set I2C clock rate to 100KHz and use HAL_I2C_Master_Receive command to receive I2C data, the I2C_WaitOnRXNEFlagUntilTimeout function would intermittently return an error even if the data has been successfully received. The reason the I2C_WaitOnRXNEFlagUntilTimeout function returns an error is because STOPF flag is being detected before FXNE flag is being detect. Looking closely at the code in the I2C_WaitOnRXNEFlagUntilTimeout function, I found there is a chance for firmware to detect STOPF flag before it detects FXNE flag, even if FXNE flag is being set before STOPF flag is being set. I don't know if anyone had this issue too.
2017-10-16 03:59 PM
Yes, I am observing this issue on STM32F777 using STM32CubeMX v4.1 and STM32CubeF7 v1.8.0.
Other posts, [1]
https://community.st.com/0D50X00009XkhEkSAJ
, and [2]https://community.st.com/0D50X00009XkfLnSAJ
report similar observation. An ST reply to [2] indicates that the issue was fixed 'in the last STM32CubeF7 version.' (It would be helpful to be explicit when referencing a version.) I believe STM32CubeF7 v1.8.0 is the latest version so should the fix be in this version?Regards,
...doug
2017-10-17 08:50 AM
The HAL gets carried away with 'common code cuteness' and sometimes this is the result. It looks like I2C_WaitOnRXNEFlagUntilTimeout() tries to serve two masters, Master and Slave receive, and fails due to a race. HAL_I2C_Mem_Read() appears to get it right.