S32K IIC Communication Error Recovery

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K IIC Communication Error Recovery

ソリューションへジャンプ
2,580件の閲覧回数
qiu
Contributor I

I use S32k146 chip.

I make an I2C communication error (SDA ,SCL short circuit).When the circuit works normally. The iic driver can recover from the error,and it will not communicate with lcd slaver any more ,And the i2c don't work.

0 件の賞賛
返信
1 解決策
2,557件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@qiu

Yes, you can take a look at UM10204

https://www.nxp.com/webapp/sps/download/preDownload.jsp?render=true 

Chapter:

3.1.16 Bus clear
In the unlikely event where the clock (SCL) is stuck LOW, the preferential procedure is
to reset the bus using the HW reset signal if your I2C devices have HW reset inputs. If
the I2C devices do not have HW reset inputs, cycle power to the devices to activate the
mandatory internal Power-On Reset (POR) circuit.

If the data line (SDA) is stuck LOW, the controller 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.

 

you can try to set the SDA & SCL as GPIO ports, then wait for nine clocks, and then restore the two ports to I2C ports

detail you can refer to this :

https://www.nxp.com.cn/docs/en/application-note/AN4803.pdf 

page 18:

tI2C_fault I2C_Restore(void)
{
 unsigned char tmp = 0;
 I2C_STOP_SIGNAL;
 I2C_DeInit();
 I2C_MASTER_SDA_PIN_AS_GPIO;
 I2C_MASTER_SDA_PIN_GPIO_HIGH_DRIVE;
 I2C_MASTER_SCL_PIN_AS_GPIO;
 I2C_MASTER_SDA_PIN_AS_OUT;
 I2C_MASTER_SDA_PIN_0;
 I2C_MASTER_SCL_PIN_AS_OUT;
 for(tmp = 0; tmp <9; tmp ++) // nine clock for data
 {
 I2C_MASTER_SCL_PIN_0;
 I2C_delay();
 I2C_MASTER_SCL_PIN_1;
 I2C_delay();
 }
 I2C_MASTER_SCL_PIN_0;
 I2C_MASTER_SDA_PIN_AS_OUT; //SDA pin set to output
 I2C_MASTER_SDA_PIN_1; //negative acknowledge
 I2C_delay();
 I2C_MASTER_SCL_PIN_1;
 I2C_delay();
 I2C_MASTER_SCL_PIN_0;
 I2C_delay();
 I2C_MASTER_SDA_PIN_0; //stop
 I2C_delay();
 I2C_MASTER_SCL_PIN_1;
 I2C_delay();

 I2C_MASTER_SDA_PIN_AS_IN;

Hope this works for you.

 

元の投稿で解決策を見る

3 返答(返信)
2,571件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@qiu

Have you tried using an oscilloscope or logic analyzer to measure the SDA and SCL waveforms?

If there is no problem with the master's transmission, then you should check whether the slave device has special recovery steps.

 

0 件の賞賛
返信
2,569件の閲覧回数
qiu
Contributor I

Yes,i used oscilloscope to measure the SDA and SCL waveform,   and the master did not  transmit any thing.

Does the S32K I2C have any recovery mechanism?

0 件の賞賛
返信
2,558件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@qiu

Yes, you can take a look at UM10204

https://www.nxp.com/webapp/sps/download/preDownload.jsp?render=true 

Chapter:

3.1.16 Bus clear
In the unlikely event where the clock (SCL) is stuck LOW, the preferential procedure is
to reset the bus using the HW reset signal if your I2C devices have HW reset inputs. If
the I2C devices do not have HW reset inputs, cycle power to the devices to activate the
mandatory internal Power-On Reset (POR) circuit.

If the data line (SDA) is stuck LOW, the controller 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.

 

you can try to set the SDA & SCL as GPIO ports, then wait for nine clocks, and then restore the two ports to I2C ports

detail you can refer to this :

https://www.nxp.com.cn/docs/en/application-note/AN4803.pdf 

page 18:

tI2C_fault I2C_Restore(void)
{
 unsigned char tmp = 0;
 I2C_STOP_SIGNAL;
 I2C_DeInit();
 I2C_MASTER_SDA_PIN_AS_GPIO;
 I2C_MASTER_SDA_PIN_GPIO_HIGH_DRIVE;
 I2C_MASTER_SCL_PIN_AS_GPIO;
 I2C_MASTER_SDA_PIN_AS_OUT;
 I2C_MASTER_SDA_PIN_0;
 I2C_MASTER_SCL_PIN_AS_OUT;
 for(tmp = 0; tmp <9; tmp ++) // nine clock for data
 {
 I2C_MASTER_SCL_PIN_0;
 I2C_delay();
 I2C_MASTER_SCL_PIN_1;
 I2C_delay();
 }
 I2C_MASTER_SCL_PIN_0;
 I2C_MASTER_SDA_PIN_AS_OUT; //SDA pin set to output
 I2C_MASTER_SDA_PIN_1; //negative acknowledge
 I2C_delay();
 I2C_MASTER_SCL_PIN_1;
 I2C_delay();
 I2C_MASTER_SCL_PIN_0;
 I2C_delay();
 I2C_MASTER_SDA_PIN_0; //stop
 I2C_delay();
 I2C_MASTER_SCL_PIN_1;
 I2C_delay();

 I2C_MASTER_SDA_PIN_AS_IN;

Hope this works for you.