FIFO overflow

Hi,

I got a BHI260AP on a Shuttle Board 3.0 and an Application board 3.0.

I modified the quaternion.c example to read additional virtual sensors from the board (accel, accel_calib, gyro, gyro_calib, ...). I created several callback functions that push the sensor data to arrays, that I then want to write to *.csv files in the end.

However, as soon as I add >2 virtual sensors with a sampling rate of 200Hz the FIFO starts to overflow. According to this document (https://www.bosch-sensortec.com/media/boschsensortec/downloads/application_notes_1/bst-bhi260ab-an002.pdf) I should have "plenty" of FIFO space available (Figure 3 -> 240KB/2?).

If I calculate the amount of data (let's say 4 virtual sensors, 200Hz each, 3*16bit) I would arrive at 4.8KB / second. That should not exhaust the FIFO right? I tried flushing the FIFO in the main loop, but that made no difference? I also increased WORK_BUFFER_SIZE from 2048 to 8192 but that did not make a difference either.

        bhy2_flush_fifo(RAW_ACC_ID, &bhy2);
        bhy2_flush_fifo(CALIB_ACC_ID, &bhy2);
        bhy2_flush_fifo(RAW_GYR_ID, &bhy2);
        bhy2_flush_fifo(CALIB_GYR_ID, &bhy2);

        if (get_interrupt_status())
        {
            /* Data from the FIFO is read and the relevant callbacks if registered are called */
            rslt = bhy2_get_and_process_fifo(work_buffer, WORK_BUFFER_SIZE, &bhy2);
            print_api_error(rslt, &bhy2);
           
        }
 
I also checked the timestamps differences. If the FIFO overflows there are some drops of course in the sampling rate, because data goes missing.
 
What am I doing wrong? Is it not possible to get the data from 4 sensors at the time on a PC as host and save the data? 
 
Regards
Steffen
4 replies