cancel
Showing results for 
Search instead for 
Did you mean: 

LIS3DH Best Practice for Operation

Aaron Derbyshire
Associate II
Posted on November 29, 2017 at 17:59

I am currently using the LIS3DH to obtain some acceleration data. Currently my mode of operation is to first initialise the device in Bypass mode and to configure the remainder of the parameters, then when required the device is re-configured into FIFO mode where I poll the DRDY signal until my total number of samples have been taken, then I put the device back into Bypass mode.

I have noticed that when I follow the above process for a single read and then return at some point later to perform another single read I obtain a repeated value. This has led me to re-evaluate my method of operation.

Going back to AN3308 I have noticed that I can instead switch the power mode to power down. This brings about the following, if I am using the I1_ZYXDA bit (which is supposed to be set before configuring the ODR) to set the DRDY signal should I be disabling FIFO_EN (CTRL_REG5) prior to powering the device down?

OR

Is there a better way to go about achieving my desired functionality?

Thanks in advance!

#lis3dh #config #an3308
2 REPLIES 2
Miroslav BATEK
ST Employee
Posted on November 30, 2017 at 16:32

I'm sorry but it is not clear to me what is you desired functionality, can you please descibe it more.

I have just a two comments:

- you can use FIFO threshold interrupt which will trigger the interrupt when certain number of samples is stored in FIFO (instead of polling DRDY signal and counting the number of samples by yourself)

- you should check ZYXDA bit in STATUS_REG before data reading to avoid multiple reading of the same output value

0690X00000608yvQAA.png0690X000006092AQAQ.png
Posted on December 01, 2017 at 11:07

Thank you for your reply.

In brief, I am powering up my MCU and initialising the accelerometer with my desired parameters and then putting it into power down mode. Then when prompted the MCU puts the accelerometer into an active state (sets the ODR value) and waits for the ZYXDA on INT1 to be pulled high and then takes a reading, this is then repeated for the total number of required samples before putting the accelerometer  into Power Down mode. I am not using the FIFO functionality as the MCU has nothing to process in the meantime and therefore pends on the INT1 line.

My process for writing to the device and each registers value is as follows:

TEMP_CFG_REG = 0xC0 // Temperature sensor and ADC enabled

CTRL_REG2 = 0 // No filtering requirements

CTRL_REG4 = 0 // Fs = 2g, 8 Bit Resolution

CTRL_REG6 = 0 // Interrupt Polarity Active High

FIFO_CTRL_REG = 0x80 // Stream mode, interrupt triggered on INT1

CTRL_REG3 = 0x10 // ZYXDA_EN

CTRL_REG5 = 0 // FIFO Disabled

CTRL_REG1 = 0x4F // 50Hz, 8 Bit resolution, XYZ axis' enabled