imx8m ic2 reset

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

imx8m ic2 reset

886 Views
ricardo_fernandes
Contributor II

Hi.

I founded that many times after long time (could be days, weeks or months) the ic2 bus 1 stops to work properly.

When it's working properly I have:

> i2cdump -y 1 0x50
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f 0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

> i2cget -y 1 0x50 0
0x00

 

When it's not working properly I have:

> i2cdump -y 1 0x50
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f 0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX

> i2cget -y 1 0x50 0
Error: Read failed

 

If I reboot the device it starts to work ok again.

Is there a command to reset ic2?

I need to understand what's causing it but I would like also to check if is possible to fix it just by executing a simple command.

 

Thanks in advance.

RF

0 Kudos
6 Replies

859 Views
ricardo_fernandes
Contributor II

Hi.

 

Thanks for your reply.

 

Yes, indeed it's a custom board.

 

Sounds bad right?

 

Best regards.

0 Kudos

852 Views
Alejandro_Salas
NXP TechSupport
NXP TechSupport

The first thing that you can check is that slave device with your 0x50 slave address. Your hardware connection. But as the issue is in a random times, check just when the issue is present.

 

Best regards.

0 Kudos

846 Views
ricardo_fernandes
Contributor II

Hi.

 

I don't have physical access to the device only remote. I know that is not a bad connector because when I reboot the device it fixes it.

Is there any command that I can execute in order to restart the I2C? Alternatively I can create a small C service and run to restart it but I'm not sure if is possible with the API.

Remotely I cannot do a lot...

If I don't find a solution I will create a workaround to reboot the device when it happens....but this is not a fix is just a temporary workaround.

Best regards.

0 Kudos

824 Views
Alejandro_Salas
NXP TechSupport
NXP TechSupport

Hello, 

Unfortunately, it is not possible to reset the I2C bus from the Linux OS (Does not exist any command to do it). But, when it happens, I am guessing you have the issue only in the slave and not in all the BUS.

About of reset by software, I believe that is possible, you can check the reference manual, for the IMX8M in the section 16.1.4.8 is described the two ways to do a reset in the I2C bus.

Alejandro_Salas_0-1674147162996.png

You must check the I2C_I2CR register, exactly the IEN bit.

Alejandro_Salas_1-1674147272384.png

 

Best regards!

 

0 Kudos

798 Views
ricardo_fernandes
Contributor II

Many thanks.

 

I'll try the reset.

 

Best regards.

863 Views
Alejandro_Salas
NXP TechSupport
NXP TechSupport

Hello!

That issue occurs when the I2C bus do not recognize the slave or in other words, the slave do not acknowledge the slave address.

For example, in my case I am using an IMX8MN and when I set the command i2cdetect 1:

Alejandro_Salas_0-1673892247495.png

I have that slaves connected in the BUS.

If I set the command i2cdump -y 1 0x52:

Alejandro_Salas_1-1673892333025.png

I had the expected.

But if I try with the 0x53 slave (Not in the BUS):

Alejandro_Salas_2-1673892376937.png

I had the same log that to have.

So, that make me think that the problem is in the slave device. 

Are you using a custom board?

 

Best regards.

0 Kudos