Skip to main content
Visitor II
August 22, 2023
Solved

LSM6DSO occasionally indicates Accelerometer data is ready and Gyroscope data is not ...

  • August 22, 2023
  • 3 replies
  • 2586 views

LSM6DSO occasionally indicates Accelerometer data is ready and Gyroscope data is not.  But, the odd thing is, if the Gyroscope data is read regardless of it's state of readiness, the Gyroscope values continue to change as expected.  Specifically, the Gyroscope data still looks good.

It was expected that the Gyroscope data would be "frozen" or "all zeros" when the Gyroscope ready bit was zero.  It was not expected the Gyroscope data would still be changing and reflect what physically was happening to the Gyroscope sensor. 

Specifics:
Chip: LSM6DSO
Register: LSM6DSO_STATUS_REG (0x1EU)
Bits:  XLDA (bit 0) & GDA (bit 1)

    This topic has been closed for replies.
    Best answer by Rstua.1


    > But it is not clear (not documented) if this register is read with clear...

    At the bottom of the STATUS_REG page (Table 81) it is stated "reset when one of the high parts of the output data is read".  So the Gyroscope bit is cleared.  But because of the READ of the HIGH BYTE of the Gyroscope... hum, probably any of the 3 registers OUTX_L_A, OUTY_L_A or OUTZ_L_A. 

    Likely, as I was reading the Gyroscope data every time the Accelerometer data was ready to be read, the Gyroscope data may sometimes never become available.  As I may be reading (clearing) the Gyroscope faster than the Gyroscope could replenish the data.

    I changed my code to only read the Gyroscope data if the Gyroscope available flag is set to 1.  I still see cases when the Accelerometer is available while the Gyroscope is not.  But there are fewer of these incidents.  Down from more then 10 in a cluster to less then 5.  And now the clusters are spaced out with an "available" Gyroscope reading between the incidents.

    3 replies

    Rstua.1Author
    Visitor II
    August 22, 2023

    As an added point of reference ...

    The Accelerometer and Gyroscope READY BIT are in the same register.  But it is not clear (not documented) if this register is read with clear.  In case it was a read with clear, I replaced the STMicro HAL code with my own. I read the register once and extract the Accelerometer Ready flag and Gyroscope Ready flag from that single read.  But I still see streaks of reads where the Accelerometer is Ready but the Gyroscope is Not Ready.

    In the following capture, the Gyroscope X, Y & Z are the 1st 3 numbers in each line.  A warning is printed only when the Accelerometer Ready flag is not the same as the Gyroscope Ready flag:

    80, -16, -1570, -9.07, 135.38, -156.71,
    68, -11, -1542, 5.47, -134.97, 19.70,
    45, 11, -1554, -7.82, 133.81, -157.92,
    46, 12, -1603, 5.47, -134.93, 19.66,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    60, 0, -1624, -8.45, 134.49, -157.26,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    43, 23, -1674, 6.35, -136.38, 20.60,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    21, 37, -1711, -7.19, 133.51, -158.55,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    12, 32, -1724, 6.61, -135.77, 20.86,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    32, 15, -1721, -8.16, 134.54, -157.60,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    52, -7, -1691, 5.67, -134.31, 19.84,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    60, -11, -1655, -8.63, 134.74, -157.12,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    74, -18, -1655, 5.01, -133.92, 19.13,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    81, -32, -1656, -8.97, 135.67, -156.85,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    46, 2, -1650, 6.48, -136.12, 20.69,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    12, 27, -1657, -7.10, 134.16, -158.67,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    23, 36, -1625, 5.94, -136.83, 20.14,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    12, 35, -1607, -6.58, 134.28, -159.19,
    WARNING: (acc:1, gyro:0) imu acc avail != imu gyro!!!
    32, 35, -1584, 4.89, -137.01, 19.12,
    0, 15, -1587, -4.92, 135.86, -160.83,
    16, 21, -1607, 4.09, -137.42, 18.35,
    31, 3, -1612, -5.54, 136.97, -160.28,
    3, 11, -1602, 5.36, -137.79, 19.52,

    Rstua.1AuthorAnswer
    Visitor II
    August 22, 2023


    > But it is not clear (not documented) if this register is read with clear...

    At the bottom of the STATUS_REG page (Table 81) it is stated "reset when one of the high parts of the output data is read".  So the Gyroscope bit is cleared.  But because of the READ of the HIGH BYTE of the Gyroscope... hum, probably any of the 3 registers OUTX_L_A, OUTY_L_A or OUTZ_L_A. 

    Likely, as I was reading the Gyroscope data every time the Accelerometer data was ready to be read, the Gyroscope data may sometimes never become available.  As I may be reading (clearing) the Gyroscope faster than the Gyroscope could replenish the data.

    I changed my code to only read the Gyroscope data if the Gyroscope available flag is set to 1.  I still see cases when the Accelerometer is available while the Gyroscope is not.  But there are fewer of these incidents.  Down from more then 10 in a cluster to less then 5.  And now the clusters are spaced out with an "available" Gyroscope reading between the incidents.

    Technical Moderator
    August 30, 2023

    Hi @Rstua.1 ,

    To better understand your problem, can you share your writings?

    Thanks