Hi Lu,
As you mention If the data line (SDA) is stuck LOW, the master should send nine clock pulses. The device that held the bus LOW should release it sometime within those nine clocks. If not, then use the HW reset or cycle power to clear the bus.
What you need to do is to switch SCL and SDA lines to GPIO output and input respectively. To do this you will need to change PORTx_PCRn(MUX) and GPIOx_PDDR. Then you generate clock cycles at the same frequency as is normally used.
Please check the below community threads, I believe they can be helpful for you.
I2C device dead-lock recovery
https://community.nxp.com/thread/394582
Have a great day,
Felipe
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------