Skip to main content
Explorer
November 7, 2023
Solved

ISM330DHCX: Gyro range in driver: calculation does not make sense

  • November 7, 2023
  • 2 replies
  • 1740 views

Greetings,

 

I am trying to figure out the full chain scaling values for the gyro and accelerometer of the ISM330DHCX. I am reading the datasheet as well as the AN5398. 

 

According to the datasheet the output values of accelerometer and gyro is scaled with the configured range over an int16 to milli-g and milli-dps. So to convert an acceleration reading for with the sensor configured to 2g we do:

scale = 2 * 1000 / 2**15
accel = raw * scale // accel now in milli-g

 

for 2g scale is about 0.061. The same formula can be used to get the scale for the other ranges. For acceleration these values make sense in existing drivers (linked below).

 

However, when doing the same calculation for the gyro range things do not make sense. E.g. for a range of 250 dps we should get:

scale = 250 * 1000 / 2**15 = 7.629

but this value is not the one that is listed in existing drivers, there rather 8.75 is listed which corresponds to a range of 286.72 dps! The example output in table 20 in AN5398 also corresponds to the 8.75 scale rather than the expected 7.629. What is the correct way to calculate the scale of the gyro and is this documented somewhere?

Best regards, Gaute

 

Existing drivers:
https://github.com/STMicroelectronics/ism330dhcx-pid/blob/master/ism330dhcx_reg.c#L91
https://github.com/adafruit/Adafruit_LSM6DS/blob/master/Adafruit_LSM6DS.cpp#L491 

    This topic has been closed for replies.
    Best answer by Federica Bossi

    Hi @GHope.2 ,

    Yes, for the sensitivity you can refer to the Table 2 of the Datasheet: you need to multiply the output in LSB by the sensitivity value corresponding to your full scale.

    2 replies

    GHope.2Author
    Explorer
    November 7, 2023

    I found the mdps / LSB section in Table 2 in the datasheet. I assume this explains it?

    Technical Moderator
    November 9, 2023

    Hi @GHope.2 ,

    Yes, for the sensitivity you can refer to the Table 2 of the Datasheet: you need to multiply the output in LSB by the sensitivity value corresponding to your full scale.