2017-11-29 08:59 AM
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? ORIs there a better way to go about achieving my desired functionality? Thanks in advance!#lis3dh #config #an33082017-11-30 07:32 AM
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
2017-12-01 03:07 AM
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 enabledCTRL_REG2 = 0 // No filtering requirementsCTRL_REG4 = 0 // Fs = 2g, 8 Bit ResolutionCTRL_REG6 = 0 // Interrupt Polarity Active HighFIFO_CTRL_REG = 0x80 // Stream mode, interrupt triggered on INT1CTRL_REG3 = 0x10 // ZYXDA_ENCTRL_REG5 = 0 // FIFO Disabled
CTRL_REG1 = 0x4F // 50Hz, 8 Bit resolution, XYZ axis' enabled