BAC & Accelerometer ODR relationship

By vincentb1 , 8 July 2019

I am using ICM20648 with ICM20648_eMD_nucleo_1.0 driver.
File invn/firmware/emd-mcu/nucleo/icm20648/iar-cm4-fpu/1.0.0/sources/Invn/Devices/Drivers/Icm20648/Icm20648DataBaseControl.c lines 392-393 are as follows:

` // estimate closest decimator value to have 56Hz multiple and apply it
lBACMinDly = 1000/(get_multiple_56_rate(lBACMinDly));`

The comment is inaccurate, as to get the closest value one needs the following code:

 // estimate closest decimator value to have 56Hz multiple and apply it
short integer BACRate = get_multiple_56_rate(lBACMinDly);
lBACMinDly = (1000+(BACRate>>1))/BACRate;

Now, assume that I want to get accelerometer samples at (1125/40)Hz = 28,125Hz. If the BAC is off, then passing 36000μs period to inv_device_set_sensor_period_us will make it (accelerometer divider will be set to ÷40). But when the BAC is running, because of the above « round down » instead of « round to closest », divider will be set to ÷19 instead of ÷20, so I presume that I will get (1125/38)Hz = 29,605Hz accelerometer sampling instead of the desired 28,125Hz.

This is a surprising behaviour, as 28,125Hz is half of the 56,25Hz needed by BAC. So it seems that the driver has BAC getting accelerometer samples at 59,210Hz instead of 56,25Hz, which is inconsistent with code comments and documentation.

phpbb Topic ID
37549