2023-06-18 10:52 AM
We are observing that LSM6DSV FIFO Timestamp is drifting at a constant rate when Gyro sensor is enabled.
Our Implementation
We are using 6-axis IMU sensor LSM6DSV with st_lsm6dsvx driver from ST GitHub and integrated with OSD32MP157 SiP.
We've modified the original driver to configure the sensor as follows:
- Configure the ODR-triggered mode as per sec 3.3 of Application note AN5922.
- Configure the Timestamp resolution by using the INTERNAL_FREQ_FINE register value and formula as per sec 6.4 of Application note AN5922.
- Configure the accel and gyro to operate in one of the following power modes:
High-accuracy ODR mode at 25Hz as per Table 11 and Table 14 of Application note AN5922.
ODR-triggered mode at 25Hz as per Table 15 of Application note AN5922.
We've NOT configured the actual ODR using the INTERNAL_FREQ_FINE register value as we are using ODR-triggered mode. The selected ODR for both accel and gyro is set to 25 Hz.
For ODR-triggered mode, we generate an External reference signal as per Figure 2 of Application note AN5922.
For High-accuracy ODR mode, no External reference signal is generated.
Our Experiment and Observations
First we tested with ODR-triggered mode and saw drift on both Hardware and Software timestamp.
Next we tested with High-accuracy ODR mode and see following observations
- We don't see any timestamp drift when Accel alone is enabled.
- We see a constant drift when gyro alone or both accel and gyro are enabled.
Following plots are from the experiment we ran with High-accuracy ODR mode with only accel at the beginning, and as you can see there is no drift during this period.
We activated the gyro and you can see a visible constant drift comes right after the activation of gyro.
These plots are FIFO timestamp vs system clock.
The first plot is for the IIO_CHAN_SOFT_TIMESTAMP (hw->tsample).
The second plot for the same experiment is for the IIO_CHAN_HW_TIMESTAMP (hw->hw_timestamp_global).
Currently, we are getting the following drifts with the activated sensors:
- Accel-only: zero drift
- Gyro-only: a constant negative drift
- Both Accel and Gyro activated: a negative drift bigger than the last case in absolute terms.
It’s possible that a mutex or lock alone may not be the cause of this. One variable that could compensate for the drift (and it does so for accel-only case) is the Timestamp resolution calculated based on INTERNAL_FREQ_FINE register value.
We would like to get the confirmation from the ST that INTERNAL_FREQ_FINE register value is calibrated for the device and not the sensor-based (Accel)
Any help resolving this timestamp drift is much appreciated.
/Farid.
2023-08-03 04:50 AM
Hi Farid,
INTERNAL_FREQ_FINE is based on the gyro frequency so it can be used in gyro only or combo but it is not valid for XL Only.
The ODR can drift for different reasons: stress (bending or soldering), temperature, Vdd etc. on DS you can find spec that reports a maximum of +/-1% for gyroscope as in the screenshot attached.
However look at the note 11: these values are specified by design but non tested in production.
Hope this helps.
Marco