Actually I think my issue is not in the sampling rate, but in the parsing of the FIFO frame. The FIFO seems to contain the correct number of bytes, but when I extract the accelerometer etc data it retrieves only a few readings because it encounters and invalid frame type and discards the rest of the buffer. Am I doing something wrong here? void Bmi270Application::ReadFifo() { bmi2_fifo_frame frame = {}; frame.data = fifo_data_; frame.header_enable = true; { uint16_t length; bmi2_get_fifo_length(&length, device_); DS_ALWAYS("{} bytes in fifo", length); frame.length = std::min((uint16_t)std::size(fifo_data_), length); } if ( auto res = bmi2_read_fifo_data(&frame, device_); res != BMI2_OK ) { display_error("Failed to read fifo", res); return; } { std::array<bmi2_sens_axes_data, 400> acceleration_data; uint16_t accel_reading_count = acceleration_data.size(); auto res = bmi2_extract_accel(acceleration_data.data(), &accel_reading_count, &frame, device_); if (res < 0) { display_error("Failed to extract accel data", res); return; } DS_ALWAYS("Got {} accelerometer samples", accel_reading_count); DS_ALWAYS("Accel x:{} y:{} z:{}", acceleration_data[0].x, acceleration_data[0].y, acceleration_data[0].z); } { std::array<bmi2_sens_axes_data, 400> gyro_data; uint16_t reading_count = gyro_data.size(); auto res = bmi2_extract_gyro(gyro_data.data(), &reading_count, &frame, device_); if (res < 0) { display_error("Failed to extract Gyro data", res); return; } DS_ALWAYS("Got {} gyro samples", reading_count); DS_ALWAYS("Gyro x:{} y:{} z:{}", gyro_data[0].x, gyro_data[0].y, gyro_data[0].z); } if ( use_aux_) { std::array<bmi2_aux_fifo_data, 400> data; uint16_t reading_count = data.size(); auto res = bmi2_extract_aux(data.data(), &reading_count, &frame, device_); if (res < 0) { display_error("Failed to extract Gyro data", res); return; } DS_ALWAYS("Got {} aux samples", reading_count); aux_sensor_data_frame f; memcpy(f.raw, data[0].data, std::min(sizeof(f.raw), sizeof(data[0].data))); DS_ALWAYS("Mag x:{} y:{} z:{}", f.mag.x, f.mag.y, f.mag.z); } }
... View more