AnsweredAssumed Answered

LIS3DH does not output 12-bit high performance resolution as expected.

Question asked by Kefei Yao on Mar 9, 2018
Latest reply on Mar 13, 2018 by Kefei Yao

The register configuration is as below array which corresponds to ctrl_reg 1-5 of LIS3DH. I read back the ctrl_reg after configure it, the result is correct which means the register is programmed to the value as I wanted. The result I expected is that I could get 12-bit data from OUT_X_L(28h) - OUT_Z_H(2Dh). But the result is I could only get 8-bit data from those registers. The MSB's of the data output registers are always zero. The function I am using to read the acceleration data is copied below as well, where the last parameter of i2c_read as 1 meas burst read. I'm wondering what the problem is to prevent me from getting 12-bit output data. Thanks.

uint8_t ctrl_reg[5]=
{

/* Enable x,y,z accelaration detect, normal mode, with 400HZ odr */
0x77,

/* Enable high pass filter for AOI1 */
0x09,

/* Enable IA1 on INT1 */
0x40,

/* Full Scale 2g, high resolution
0x08,

/* Fifo Disabled */
0x00
};

 

void accel_read(int16_t* accel)
{
uint8_t buffer[6];
i2c_read(OUT_X_L,buffer,6,1);
accel[0]=(buffer[1]<<8)|buffer[0];
accel[1]=(buffer[3]<<8)|buffer[2];
accel[2]=(buffer[5]<<8)|buffer[4];
}

Outcomes