Hi
I'm working on a project interfacing the nRF52840 board with the lis2dh12 accelerometer
I'm using SDK 15.3, basing my code on the provided driver and information I've found here
I've used the TWI manager configuration native to the example
the issue I'm encountering is that it seems like the accelerometer stops collecting data after the first time I'm reading from it
the datasheet states that in FIFO mode, it requires a reset to reenable FIFO mode
I thought that calling LIS2DH12_FIFO_CFG and committing the configuration to the device will do the trick, but it doesn't seem to fix the issue
my configuration:
const nrf_drv_twi_config_t twi_instance_config = { .scl = ACC_SCL, .sda = ACC_SDA, .frequency = NRF_DRV_TWI_FREQ_100K, .interrupt_priority = APP_IRQ_PRIORITY_HIGH, .clear_bus_init = false }; errorCode = nrf_twi_mngr_init(&m_nrf_twi_mngr, &twi_instance_config); APP_ERROR_CHECK(errorCode); errorCode = nrf_twi_sensor_init(&m_nrf_twi_sensor); APP_ERROR_CHECK(errorCode); errorCode = lis2dh12_init(&m_lis2dh12); APP_ERROR_CHECK(errorCode); // data acquisition configuration: 100HZ sample rate, low power mode, x axis, y axis, z axis, values in range -2g <-> +2g, disable high resolution mode (in this case step size is 256) LIS2DH12_DATA_CFG(m_lis2dh12, LIS2DH12_ODR_100HZ, false, true, true, true, LIS2DH12_SCALE_2G, false); errorCode = lis2dh12_cfg_commit(&m_lis2dh12); APP_ERROR_CHECK(errorCode); // FIFO configuration: enable FIFO, FIFO mode, int1 pin used, 32 values watermark LIS2DH12_FIFO_CFG(m_lis2dh12, true, LIS2DH12_FIFO, false, LIS2DH12_MIN_QUEUE_SIZE); errorCode = lis2dh12_cfg_commit(&m_lis2dh12); APP_ERROR_CHECK(errorCode); // interrupt configurataion: LIS2DH12_INT1_PIN_CFG(m_lis2dh12, false, enableInterrupts, false, false, false, enableInterrupts, true, false); errorCode = lis2dh12_cfg_commit(&m_lis2dh12); APP_ERROR_CHECK(errorCode);
and after data read is finished, I'm using the same call to LIS2DH12_FIFO_CFG with the same configuration
Is there something I'm missing here?
Is there any example code working with FIFO mode?
any and all help would be appreciated