cancel
Showing results for 
Search instead for 
Did you mean: 

Question about LIS3DH acceleration data

xia
Associate
Posted on January 27, 2015 at 06:47

 1) Question1 I am reading the the data sheet of LIS3DH AN3308.  I doubt about the description of 3.2.3(Example of accleration data).

350(0x15E)mg register data is Val_0x29 = 0x15, Val_0x28 = E0 (left-justified)

It is OK of BLE

1g(0x400mg) register data is Val_0x29 = 0x04, Val_0x28 = 0x00

Is it correct example?? I think it should be  Val_0x29 = 0x40, Val_0x28 = 0x00

2) I download LIS3DH driver code from st.com 

stsw-mems023_LIS3DH Linux OS device driver.zip

the get acceleration data code is as the following,

acc_data[0] = (AXISDATA_REG); 

err = lis3dh_acc_i2c_read(stat, acc_data, 6);

hw_d[0] = (((s16) ((acc_data[1] << 8) | acc_data[0])) >> 4);

hw_d[1] = (((s16) ((acc_data[3] << 8) | acc_data[2])) >> 4);

hw_d[2] = (((s16) ((acc_data[5] << 8) | acc_data[4])) >> 4);

In fact, the output resolution is 12bit, not 16bit ???

I found the output resolution description at LIS2DH data sheet

But not found at LIS3DH, In AN3308

3.2.1 Data alignment

    Acceleration data are represented as 16-bit numbers and are left justified.

Thanks

 

#lis3dh-data-format
1 REPLY 1
gavrilov
Associate II
Posted on January 28, 2015 at 05:50

<AN3308>

9.1 FIFO description

The FIFO buffer is able to store up to 32 acceleration samples of 10 bits for each channel; data are stored in the 16-bit 2’s complement left justified representation.