This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Error 195952641 on I2C, when power management is enabled.

Hello, when developing our application, we run into a problem. We are running Zephyr 2.4.0 on nRF52840 MCU. We use LSM303AGR sensor, which is supported by zephyr LIS2DH driver. The threshold exceeded interrupt from sensor are used, and after some time from booting, the device logs such error:
<err> i2c_nrfx_twi: Error 195952641 on I2C line occurred for message 0
<err> lis2dh: clearing interrupt 2 failed: -5
As I have find out, this is no ACK from slave, when sending address error.
As we have figured out, this is somehow connected with power management, which we use because it is battery powered device. When the following lines from config are deleted:
CONFIG_SYS_POWER_MANAGEMENT=y
CONFIG_SYS_POWER_SLEEP_STATES=y
CONFIG_DEVICE_POWER_MANAGEMENT=y
the problem doesn't occur.
Has someone faced such problem, and got any solution? If there are more information needed, let me know.
Parents
  • Let's try to narrow down the issue, what happens if you change the value of CONFIG_IIS2DH_POWER_MODE?

    Take a look at <sample>/build/zephyr/.config to see the initial value.

    Check out https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.1/kconfig/CONFIG_IIS2DH_POWER_MODE.html, to see the allowed values.

    Best regards,

    Simon

  • Changing power mode of sensor has no effect on this, the problem still occurs. I have found out that mocking function twi_nrfx_pm_control in i2c_nrfx_twi.c to do nothing resolves the problem, but then the I2C is not stopped when MCU goes into low power mode.

  • It's a little hard to debug since I don't have access to that sensor right now. Would you be able to attach a logic analyzer to the output to see what's going on?

    By the way, if you comment out everything inside twi_nrfx_pm_control(), what current consumption do you see while in idle? I think the twi should release the HF clock after use automatically, so it shouldn't use too much power then I think.

    Have you tried to use twim instead of twi? Do you see this issue then?

    By the way, I'm going on vacation the next week, so I won't be able to provide you any answers next week.

  • I understand that its hard. Unfortunately I'm not able to connect logic analyzer to I2C lines, due to small size of components and the board itself. I was trying to do it, but with no luck.
    I haven't measured the current consumption, but will do this probably this week.
    When I use twim instead of twi, I can only communicate with one device (the LSM303 sensor shows as two devices on the bus), but when we used only accelerometer with twim, the problem didn't occur.

  • Kacper said:
    I haven't measured the current consumption, but will do this probably this week.

    If you measure a low current with everything inside twi_nrfx_pm_control() commented out then you have a workaround for this issue.

    Kacper said:
    I understand that its hard. Unfortunately I'm not able to connect logic analyzer to I2C lines, due to small size of components and the board itself. I was trying to do it, but with no luck.

    A logic trace would be very useful. I will see if I can get a hold of a LSM303 sensor and try to reproduce the issue on my side.

    Kacper said:
    When I use twim instead of twi, I can only communicate with one device (the LSM303 sensor shows as two devices on the bus), but when we used only accelerometer with twim, the problem didn't occur.

    The TWIM should be able to communicate with multiple slaves connected to the same bus, so I'm not sure what's going on.

    I will wait for you current measurement results and look into the issue further if needed.

    Best regards,

    Simon

Reply
  • Kacper said:
    I haven't measured the current consumption, but will do this probably this week.

    If you measure a low current with everything inside twi_nrfx_pm_control() commented out then you have a workaround for this issue.

    Kacper said:
    I understand that its hard. Unfortunately I'm not able to connect logic analyzer to I2C lines, due to small size of components and the board itself. I was trying to do it, but with no luck.

    A logic trace would be very useful. I will see if I can get a hold of a LSM303 sensor and try to reproduce the issue on my side.

    Kacper said:
    When I use twim instead of twi, I can only communicate with one device (the LSM303 sensor shows as two devices on the bus), but when we used only accelerometer with twim, the problem didn't occur.

    The TWIM should be able to communicate with multiple slaves connected to the same bus, so I'm not sure what's going on.

    I will wait for you current measurement results and look into the issue further if needed.

    Best regards,

    Simon

Children
No Data
Related