Hi Liangliang Ma
According to the Reference Manual, BBF flag is set when LPI2C master is enabled and activity detected on I2C bus, but STOP condition has not been detected and bus idle timeout (if enabled) has not occurred.
So the way that you can clear BBf flag is if you disable LPI2C master and then you enable it again, so before you clear ALF, you could diable and enable the LPI2C module with the LPI2C_MCR[MEN] bit.
Another method is if you use the bus idle timeout, BUSIDLE, this configures the bus idle timeout period in clock cycles and If both SCL and SDA are high for longer than BUSIDLE cycles, then the I2C bus is assumed to be idle and the master can generate a START condition
Hope this information helps you
Have a great day,
Jorge Alcala
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------