I2C Reset via 9 clock pulse in FRDM-K64 and FreeRTOS

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

I2C Reset via 9 clock pulse in FRDM-K64 and FreeRTOS

跳至解决方案
3,823 次查看
darshan_shah1
Contributor II

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.

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
3,707 次查看
ErichStyger
Specialist I

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

在原帖中查看解决方案

0 项奖励
回复
1 回复
3,708 次查看
ErichStyger
Specialist I

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

0 项奖励
回复