kriswiner/EM7180_SENtral_sensor_hub

Overlap of Accel Calibration Regs and LPF BW Regs

Closed this issue · 7 comments

Register 0x5B is used for both setting the accelerometer LPF bandwidth and for setting the accelerometer calibration.

From Global.h:
EM7180_ACC_LPF_BW = 0x5B
EM7180_GP36 = 0x5B

How does the EM7180 distinguish between the two different values being written to 0x5B? Both writes are done after setting host control to 0x00 so my only guess is that it has to do with the magnitude of the value being written.

I understand. So how does the EM7180 know when I'm writing 0x03 to the register for 41Hz LPF BW, I'm not actually writing a value for the accelerometer calibration? What if I switched the order so that we wrote the LPF BW first followed by the accelerometer calibration?

In the actual code, EM7180_acc_cal_upload() writes to the register, and then a few lines down the same register is written to with a value for setting LPF.

FWIW, I'm using a different code base that's heavily inspired by the code in this repo so it's possible I'm doing something differently.

I noticed that my linear-acceleration samples had bias which is why I began investigating. I just removed the LPF BW code and now the linear-acceleration samples are much cleaner. So at least in my case, I suspect that the LPF writes were being interpreted as calibration parameters.

I should have brought this up sooner, but I'm actually using the LSM6DSM + LIS2MD USFS. Any chance the GP registers used for accel calibration or LPF BW are different from the MPU9250 USFS? It was only after I read #39 that it occurred to me that there might be a difference.

Makes sense. Thanks!