[iis3dwb] Read sensor data without loss.
Hi,
I want to receive data coming from the sensor without loss.
For the testing, sampling rate is set to 32Hz.
26667(ODR) / 800 = 32hz

if set like this, 32 data per second will be accumulated in the buffer.
and CNT_BDR_THR was set to 100.
also, FIFO_MODE was set to continus mode.
I am reading data by checking counter_bdr_ia as shown in the code below.
My expectation is that counter_bdr_ia should occur approximately once every 3 seconds, but counter_bdr_ia is occurring faster than that.
Please let me know what's wrong. Or please give me an example for reading without data loss.
uint16_t fifoDataCnt;
iis3dwb_fifo_status2_t countFlag;
static uint32_t time_count = 0;
while(1){
time_count = XTHAL_GET_CCOUNT();
iis3dwb_fifo_data_level_get(&dev_low_ctx, &fifoDataCnt);
iis3dwb_fifo_status_get(&dev_low_ctx, &countFlag);
if(countFlag.counter_bdr_ia == 1)
{
printf("Buff chk Before %d %d counter_bdr_ia %d \n", time_count, fifoDataCnt
, countFlag.counter_bdr_ia
);
for(int i = 0; i<100; i++)
{
iis3dwb_fifo_out_raw_get(&dev_low_ctx, (uint8_t *)sensor_raw);
}
iis3dwb_fifo_data_level_get(&dev_low_ctx, &fifoDataCnt);
iis3dwb_fifo_status_get(&dev_low_ctx, &countFlag);
printf("Buff chk After %d counter_bdr_ia %d \n", fifoDataCnt
, countFlag.counter_bdr_ia
);
}
else
{
printf("Time %d\n", time_count);
vTaskDelay(10 / portTICK_PERIOD_MS);
}
}
