Hi,
Sometimes while doing I2C communication, I was getting error "I2C Busy" status 1100 from the i2c driver.
I am testing in remote set-up so unfortunately I am not able to take SCL and SDA line pulses on CRO.
I would like to implement 9-clock pulse reset yet I don't find any guide or code in I2C driver.
Please suggest a way.
Solved! Go to Solution.
Hi Darshan,
I have implemented this and using it in different projects with the MCUXpresso SD, including in this one: Building a Raspberry Pi UPS and Serial Login Console with tinyK22 (NXP K22FN512) | MCU on Eclipse
There is an example project for this on GitHub (mcuoneclipse/Examples/MCUXpresso/tinyK22/tinyK22_RaspberryPi_UPS at master · ErichStyger/mcuoneclips... ), have a look at the I2CLib_ResetBus() function in mcuoneclipse/i2clib.c at master · ErichStyger/mcuoneclipse · GitHub .
Basically it re-muxes the pins as GPIO pins, does the 9 clocks and then switches back to the I2C normal muxing.
I call the release bus always after reset, because the slaves on the bus could be already blocking if not doing a power-on reset. As for using the bus or the I2CLib functions from tasks, there is a mutex implemented in it to allow multiple tasks accessing the bus in a reentrant way.
I hope this helps,
Erich
Hi Darshan,
I have implemented this and using it in different projects with the MCUXpresso SD, including in this one: Building a Raspberry Pi UPS and Serial Login Console with tinyK22 (NXP K22FN512) | MCU on Eclipse
There is an example project for this on GitHub (mcuoneclipse/Examples/MCUXpresso/tinyK22/tinyK22_RaspberryPi_UPS at master · ErichStyger/mcuoneclips... ), have a look at the I2CLib_ResetBus() function in mcuoneclipse/i2clib.c at master · ErichStyger/mcuoneclipse · GitHub .
Basically it re-muxes the pins as GPIO pins, does the 9 clocks and then switches back to the I2C normal muxing.
I call the release bus always after reset, because the slaves on the bus could be already blocking if not doing a power-on reset. As for using the bus or the I2CLib functions from tasks, there is a mutex implemented in it to allow multiple tasks accessing the bus in a reentrant way.
I hope this helps,
Erich