AnsweredAssumed Answered

How to get mG from LSM303DLHC

Question asked by Bi ribu on Nov 13, 2017
Latest reply on Nov 14, 2017 by Miroslav B

I have developed a very simple driver for this sensor. I have a stm32f411ve discovery board which has one included.

 

This is my configuration:

 

PM_LSM303DLHC_config.ctrl_reg1_a = 0x27;
PM_LSM303DLHC_config.ctrl_reg2_a = 0x00;
PM_LSM303DLHC_config.ctrl_reg3_a = 0x00;
PM_LSM303DLHC_config.ctrl_reg4_a = 0x00;
PM_LSM303DLHC_config.ctrl_reg5_a = 0x00;
PM_LSM303DLHC_config.ctrl_reg6_a = 0x00;

 

As you see, the only parameter I set is reg1_a. I have tested also with 0x57.

 

This is how I parse the output:

x = (((PM_LSM303DLHC_values.out_x_h_a << 8) | (PM_LSM303DLHC_values.out_x_l_a)));
y = (((PM_LSM303DLHC_values.out_y_h_a << 8) | (PM_LSM303DLHC_values.out_y_l_a)));
z = (((PM_LSM303DLHC_values.out_z_h_a << 8) | (PM_LSM303DLHC_values.out_z_l_a)));

Where x,y and z are int32_t.

 

I get this kind of values: 64000 60480 16128 while my board is over a table. What ind of values should I see then? 

How can I get mG from this information? I haven't seen anything on the datasheet.

Outcomes