Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    FIFO overflow

    FIFO overflow

    stef87
    New Poster

    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-an00...) 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 4

    stef87
    New Poster

    I just built myself a custom firmware with: fifo,1.00

    The output tells me that I am getting 17408 bytes of non-wake FIFO. Still I am getting a FIFO overlow not even a second after startup.

    [195/196] Generating Bosch_APP30_SHUTTLE_BHI260_aux_BMM150_turbo.elf
    Reclaiming .initdata: 1508 bytes
    Reclaiming .reclaim: 1200 bytes
    Free code ram for FIFO: 0x0013e9b0 to 0x00140000 (5712 bytes)
    Free data ram for FIFO: 0x00a13800 to 0x00a18000 (18432 bytes)
    Optional RAM bank usage: Code banks=3, Data banks=2
    Free ram for FIFO: 19292
    Estimated Wake FIFO: 1536
    Estimated Non-Wake FIFO: 17408

    BSTRobin
    Community Moderator
    Community Moderator

    Hi stef87,

    You can run program in RAM or Flash and print data through COM port, which will be faster than running program on the PC side. Let the FIFO read as soon as possible each time.

    Thank you for your response.

    Could you please point me to any samples how to do that exactly, e.g. with COINES? 

    BSTRobin
    Community Moderator
    Community Moderator

    Hi stef87,

    After you install latest v2.7 COINES software, you could refer document under "C:\COINES\v2.7.0\doc" folder, enter into "C:\COINES\v2.7.0\examples\bhy2\examples\euler" folder and edit your code if you need, compile code and execute program with the command:
    mingw32-make LOCATION=RAM TARGET=MCU_APP30 download

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist