cancel
Showing results for 
Search instead for 
Did you mean: 

Question about LSM303AGR_ACC_SENSITIVITY_2G definition in lsm303agr.h

Duc
Associate

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Federica Bossi
ST Employee

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:

FedericaBossi_0-1714119369025.png

 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Federica Bossi
ST Employee

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:

FedericaBossi_0-1714119369025.png

 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

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.