We are experiencing a constant yet hardware-variable error on the timing of our watermark interrupt. We have set the ODR to 50Hz and would expect an interrupt every 1.28s for a constant readout of 64 frames.
We currently think it might be related to the clock calibration of the IMU. Yet, at 50Hz this error of ±2% seems quite high. We can not find how the clock on the IMU is calibrated, and hence don't know if this an inherent issue on the IMU's themselves or a synchronization error on e.g. the I2C clock coming from the MCU?
Below you can see the hardware with a 1.29s WM interrupt cycle.
Below you can see the hardware with a 1.26s WM interrupt cycle.
We have also performed "tap testing" on a regular interval (1min) and we can clearly see a constant offset error for each device, yet different for each device.
device1.txt ----------- Time between taps in seconds: [60.6 60.24 60.44 60.36] Total time in seconds: 241.64 Total error in seconds: 1.64
device2.txt ----------- Time between taps in seconds: [59.2 58.86 59.06 58.98] Total time in seconds: 236.1 Total error in seconds: -3.9
device3.txt ----------- Time between taps in seconds: [59.46 59.1 59.3 59.22] Total time in seconds: 237.08 Total error in seconds: -2.92
device4.txt ----------- Time between taps in seconds: [59.5 59.14 59.36 59.26] Total time in seconds: 237.26 Total error in seconds: -2.74
device5.txt ----------- Time between taps in seconds: [60. 59.6 59.84 59.74] Total time in seconds: 239.18 Total error in seconds: -0.82
Is there a way to recalibrate the clock on the IMU? Or is the variation we are seeing across boards (yet constant within every board, independent of e.g. battery voltage) related to something else?
Many thanks, @BSTRobin for any help you can provide.
Thanks for your inquiry.
BMI160 is not available for new design according to our website. Please switch to the latest IMU BMI323 which is pin-ro-pin compatible with BMI160 for your evaluation.
BMI160 has typical ODR tolerance of +/-1% (1-sigma). So 3-sigma will be +/-3%. For example when you set BMI160 accel and gyro to 50Hz, then the real ODR from part to part will be typically in the range of 49.5Hz and 50.5Hz. Considering 3-sigma for 64 frames in FIFO at 50Hz ODR, the timing will be in the range of 1.28s +/- 0.04s which is from 1.24s to 1.32s. What you observed from different PCBs is from BMI160's ODR tolerance.
BMI160 has 3-byte sensortime registers 0x18, 0x19 and 0x1A. It is a free running clock after BMI160 is powered on. You may search online for an algorithm about how to synchronize your MCU clock and BMI160 sensortime clock so that your every device will work the same way.