2024-04-24 09:10 PM
Hello STM32 community,
I've been examining the lsm303agr.h file from STMicroelectronics for the LSM303AGR accelerometer, and I came across something puzzling in line 197. In the code, it defines LSM303AGR_ACC_SENSITIVITY_2G as ((uint8_t)1), but according to the LSM303AGR datasheet, the linear acceleration sensitivity at ±2 g in normal mode is 3.9mg/LSB.
Could someone help me understand why there's a discrepancy between the code definition and the datasheet specifications? I'm curious about the reasoning behind this difference and how it might impact the usage of the accelerometer in my project.
Thank you in advance for any insights you can provide!
Solved! Go to Solution.
2024-04-26 01:16 AM - edited 2024-04-26 01:16 AM
Hi @Duc ,
This part of the code refers to the high resolution mode:
#define LSM303AGR_ACC_SENSITIVITY_2G ((uint8_t)1) /*!< accelerometer sensitivity with 2 g full scale [mg/LSB] */
#define LSM303AGR_ACC_SENSITIVITY_4G ((uint8_t)2) /*!< accelerometer sensitivity with 4 g full scale [mg/LSB] */
#define LSM303AGR_ACC_SENSITIVITY_8G ((uint8_t)4) /*!< accelerometer sensitivity with 8 g full scale [mg/LSB] */
#define LSM303AGR_ACC_SENSITIVITY_16G ((uint8_t)12) /*!< accelerometer sensitivity with 12 g full scale [mg/LSB] */
And should be changed, according to the datasheet, if the power mode changes:
2024-04-26 01:16 AM - edited 2024-04-26 01:16 AM
Hi @Duc ,
This part of the code refers to the high resolution mode:
#define LSM303AGR_ACC_SENSITIVITY_2G ((uint8_t)1) /*!< accelerometer sensitivity with 2 g full scale [mg/LSB] */
#define LSM303AGR_ACC_SENSITIVITY_4G ((uint8_t)2) /*!< accelerometer sensitivity with 4 g full scale [mg/LSB] */
#define LSM303AGR_ACC_SENSITIVITY_8G ((uint8_t)4) /*!< accelerometer sensitivity with 8 g full scale [mg/LSB] */
#define LSM303AGR_ACC_SENSITIVITY_16G ((uint8_t)12) /*!< accelerometer sensitivity with 12 g full scale [mg/LSB] */
And should be changed, according to the datasheet, if the power mode changes:
2024-04-26 11:01 PM
Hi,
Thank you for your response and clarification regarding the definition of LSM303AGR_ACC_SENSITIVITY_2G. I appreciate your prompt attention to this matter.
However, it seems there may still be some confusion. While I understand that this part of the code refers to the high-resolution mode, the discrepancy arises from the fact that in lsm303agr.c (line 240), it is noted as "Normal mode." This inconsistency between the .c and .h files could potentially confuse users who are trying to understand the operating modes and sensitivities of the LSM303AGR accelerometer.
Thank you once again for your assistance.