I'm using the BMI270 API found here with a known working hardware platform. In this configuration I'm using the FIFO in header-less mode with both Accelerometr and Gyroscope data being collected. My code is based on the example of this type and I have an issue where the last accelerometer sample is not being retrieved by the bmi2_extract_accel function from the FIFO frame. The extraction function repeatedly calls the check_dummy_frame function shown below. 37 bytes are read from the FIFO with the first being a dummy. When extracting the acceleration the the data_index is set to 31 on the 3rd acceleration sample. This sample resides in bytes 31:36 (6 bytes). The logic in the below function below fails but should instead say if(((*data_index) + 6) <= fifo->length)
As you enable accel and gyro, set the FIFO in header-less mode, FIFO data length should be 6 bytes every frame, total FIFO length should be an integer multiple of 6 bytes. FIFO length 37 didn't match it.
With BMI270 github code, I run FIFO watermark interrupt code and get correct result for your reference. https://github.com/BoschSensortec/BMI270-Sensor-API
Which example are you using? My code is based off of the FIFO Headerless Watermark example (https://github.com/BoschSensortec/BMI270-Sensor-API/blob/master/bmi270_examples/fifo_watermark_heade...). The numbers in this example wouldn't yield 100 samples of each sensor. The image below is from the linked example, (6 + 6) * 54 = 648 not 650. Is this some sort of padding to make the driver work correctly?
Previous attached code refer both github FIFO header and headerless example code, some modifications have been made based on the example code, like ODR, using hardware interrupt.