LPC54628 - I2C getting stuck

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC54628 - I2C getting stuck

1,091 Views
mateuszkiełbasa
Contributor III

I  am facing weird problem with I2C using LPC54628 board. I'm using I2C GPIO expander and everything works fine but the program always stucks after random time of working. Usually it's about 30min but sometimes after 5min... I have tried I2C2, I2C3, I2C8 with the same results. When debugging the program enters the I2C_PendingStatusWait function and the program stucks (because pending flag cannot be reached?). Removing SDA or SCL cable from slave device always works and the program could execute now. What is the problem? It's weird and dangerous. I have tried second expander and the problem is still present...

Labels (1)
0 Kudos
3 Replies

943 Views
mateuszkiełbasa
Contributor III

I found the problem. This is noise from ~230V power source. I use 5V DC power supply from ~230V and sometimes when I plug in heat station or other device the program stucks...

Maybe restarting the I2C master after stuck will solve the problem? But the fsl_i2c library from sdk has empty reset master function.

0 Kudos

943 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Mateusz,

 

You could try aborting the transmission using  I2C_SlaveTransferAbort/I2C_MasterTransferAbort API and after that De-Initialize and Initialize the module again after the timeout.

 

Best Regards,

Alexis Andalon

0 Kudos

943 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Mateuz, 

 

This looks like the slave is getting stuck in some point, I will suggest to check the if the baud rate and write/read timing is between the spec.

 

Also check with some logic analyzer in which moment the transmission is getting stuck, maybe you could aisle the issue and identify is in a respective command.

 

One workaround for this is to use a timeout, one way to do this is to check if the stop condition is not reached between a certain time, change the multiplexing of the SCK to a GPIO and toggle this pin until the slave release the lines. 

 

Let me know if this helps you

 

Best Regards,

Alexis Andalon

0 Kudos