LIS2HH12 REFERENCE for high pass filter requires scaling?
When setting high pass filter mode to HPM=01, the values in the reference registers (3Ah-3Fh) need different scaling compared to the data output registers (28h-2Dh). I am following the algorithm specified on p.18 of AN4662 using the following C code:
void accel_set_reference(void)
{
int16_t xyz[3];
lis2hh12_acceleration_raw_get(accel1, xyz); // extra dummy read
lis2hh12_acceleration_raw_get(accel1, xyz);
xyz[0] /= 8;
xyz[1] /= 8;
xyz[2] /= 8;
lis2hh12_xl_filter_reference_set(accel1, xyz);
lis2hh12_xl_filter_hp_bandwidth_set(accel1, LIS2HH12_HP_ODR_DIV_50_REF_MD);
lis2hh12_xl_filter_out_path_set(accel1, LIS2HH12_FILT_HP);
}For some reason, I need to divide the raw acceleration values by 8 before setting them as the reference values. Observe the graphs of acceleration data I obtain (the step change occurs when this function is called). First, without scaling down by 8:

Now when scaling down by 8:

Why is this scaling necessary? It is not documented anywhere (as far as I could find). I have full scale set to 2g. According to Table 13 of AN4662, the LSB value should be 0.061mg for 2g full scale, which is the same as the output data for 2g. Therefore, there should be no scaling necessary. Is there some config I might have missed that is causing this discrepancy?
