lsm6dsl FIFO data become misalignment by nrf52840 I2C reading based on NCS2.6.1

hi Nordic teams:

we meet one serious issue about LSM6DSL FIFO reading, our product (host mcu is nrf52840) need to read lsm6dsl FIFO data periodically with one second interval based on NCS2.6.1, after some times the reading FIFO data will become misalignment.

we use I2C driver to configure lsm6dsl like below:

  • XL_ODR_26HZ
  • Gyro disabled.
  • FIFO ODR = 26Hz
  • FIFO threshold (water mark) = 128
  • No decimation
  • BDU Block Update enabled
  • FIFO Is in continuous mode we have a timer to trigger to read FIFO data by Zephyr I2C(frequency: 100000bits/s) each second,

in the beginning, the reading FIFO data is the right like as (X_ACC, Y_ACC, Z_ACC). but after some time (the time is not fixed) the data will become (Y_ACC, Z_ACC, X_ACC). 

our project overlay is below:

project configuration:

because our goal is porting previous nrf5 sdk project into zephyr, so we try this FIFO reading process based on nrf5 sdk, the FIFO reading data was always right. we know the I2C driver is different between NCS2.6.1 and nrf5 SDK. but we don't know why this issue happen, can you help us to resolve this issue?

  • Hello,

    I'm not really familiar with this sensor, but it appears that Zephyr already has driver support for this device. Or is the "st,lsm6dsl" not compatible with your variant? If it is compatible, you could try it with the Generic 3-Axis accelerometer polling 

    or Accelerometer trigger sample after changing the "compatible" to "st,lsm6dsl";" in your lsm6dsl node to see if you encounter the same problem. This could help us narrow down the problem.

    Best regards,

    Vidar

  • hi,

    the "st,lsm6dsl" is not compatible with my project, our project needs to configure lsm6dsl registers like as acc ODR, FIFO ODR, FIFO water mark and so on during runtime. these configurations can't be implemented by "st,lsm6dsl" driver. it is more convenient to use i2c driver.

    Cdong

  • Hi,

    I understand that you don't want to use the sensor API in your final firmware, but I thought you could try it to see if it had the same issue. However, I'm not sure if there is much point in doing that if it doesn't support the same configuration. I recommend reaching out to the sensor manufacturer to see if they have any suggestions for this.

    Best regards,

    Vidar