Lower than expected sampling rate for accelerometer and gyroscope in FIFO mode of LSM6DSL
Hi,
I'm using the FIFO of the LSM6DSL IMU sensor to sample accelerometer and gyroscope values. I'm sampling the FIFO only once the watermark is true and read the FIFO as long as the number of patterns in the FIFO is not zero. I read the FIFO faster than it gets filled by setting an application timer every 50ms that empties the FIFO (if the watermark is true).
However, no matter I use the maximum SPI frequency or anything, I can never get as high of a sampling rate as expected. When the accelerometer or gyroscope are sampling at 416Hz, I get about 410 Hz actual samples. This number is different for different sensors (same hardware and firmware) and it can be 412 or 414 Hz, but never 416Hz. I lose a similar number of samples (about 1.4%) for different sampling rates.
Based on this discussion and this other, it seems this is due to the IMU's internal clock inaccuracy. So, is there nothing I can do to know how many samples I should expect? It seems each individual sensor has a particular frequency but each sensor is slightly different.
