2021-03-03 01:46 AM
Solved! Go to Solution.
2021-03-03 02:44 AM
Hi @NA1 ,
the FIFO block (and the watermark interrupt) can be used in all the 3 modes of the LIS2DH sensor, low power, normal and high resolution mode. The interrupt will
You can take as example the code for the LIS2DH12, similar to the LIS2DH as regards the FIFO configuration (lis2dh12_read_fifo.c:(
/* Set FIFO watermark to FIFO_WATERMARK */
lis2dh12_fifo_watermark_set(&dev_ctx, FIFO_WATERMARK - 1);
/* Set FIFO mode to Stream mode (aka Continuous Mode) */
lis2dh12_fifo_mode_set(&dev_ctx, LIS2DH12_DYNAMIC_STREAM_MODE);
/* Enable FIFO */
lis2dh12_fifo_set(&dev_ctx, PROPERTY_ENABLE);
/* Enable Block Data Update. */
lis2dh12_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
/* Set Output Data Rate to 1Hz. */
lis2dh12_data_rate_set(&dev_ctx, LIS2DH12_ODR_25Hz);
/* Set full scale to 2g. */
lis2dh12_full_scale_set(&dev_ctx, LIS2DH12_2g);
/* Set device in continuous mode with 12 bit resol. */ --> but you can set here one of the 3 modes
lis2dh12_operating_mode_set(&dev_ctx, LIS2DH12_HR_12bit);
Due to the commonality of the FIFO block among some accelerometer, I suggest you to check for example the AN5005 application note (p.51 and on) for a deep insight into the watermark feature.
Let me please know if you face any issues.
-Eleon
2021-03-03 02:44 AM
Hi @NA1 ,
the FIFO block (and the watermark interrupt) can be used in all the 3 modes of the LIS2DH sensor, low power, normal and high resolution mode. The interrupt will
You can take as example the code for the LIS2DH12, similar to the LIS2DH as regards the FIFO configuration (lis2dh12_read_fifo.c:(
/* Set FIFO watermark to FIFO_WATERMARK */
lis2dh12_fifo_watermark_set(&dev_ctx, FIFO_WATERMARK - 1);
/* Set FIFO mode to Stream mode (aka Continuous Mode) */
lis2dh12_fifo_mode_set(&dev_ctx, LIS2DH12_DYNAMIC_STREAM_MODE);
/* Enable FIFO */
lis2dh12_fifo_set(&dev_ctx, PROPERTY_ENABLE);
/* Enable Block Data Update. */
lis2dh12_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
/* Set Output Data Rate to 1Hz. */
lis2dh12_data_rate_set(&dev_ctx, LIS2DH12_ODR_25Hz);
/* Set full scale to 2g. */
lis2dh12_full_scale_set(&dev_ctx, LIS2DH12_2g);
/* Set device in continuous mode with 12 bit resol. */ --> but you can set here one of the 3 modes
lis2dh12_operating_mode_set(&dev_ctx, LIS2DH12_HR_12bit);
Due to the commonality of the FIFO block among some accelerometer, I suggest you to check for example the AN5005 application note (p.51 and on) for a deep insight into the watermark feature.
Let me please know if you face any issues.
-Eleon
2021-03-08 11:04 PM
Thank you very much for your assistance, it all works fine now.
Due to some functionality additions, I need to use INT2 as Fifo watermark interrupt instead of INT1. Is that possible, and if so how?
2021-03-09 08:46 AM
Hi @NA1 ,
glad to hear it from you!
It is possible to route all the INT1 interrupts also on INT2 (so, the I1_WTM signal too), by configuring the I2_INT1 bit of the CTRL_REG6 (25h) register (datasheet, p.36): it allows the Interrupt 1 function to be enabled on INT2 pin.
-Eleon