2023-12-06 05:39 AM
Hello,
I'm currently working with a custom board designed to read digital values from an accelerometer, specifically from the OUT_X, OUT_Y, and OUT_Z registers. However, I've encountered an issue: despite the accelerometer being physically stable, I am observing a significant number of peaks in the readings. These peaks consistently show an amplitude of around +/-250 units from the base level, which seems unusual.
For context, the values I'm observing are 16-bit, and I'm operating the device under a 2G high-speed setting with an 800Hz Output Data Rate (ODR). I'm aware that the effective resolution is 14 bits, as the values are left-justified, with the least significant 2 bits not holding valid information. Given this, I would normally expect any inaccuracies to be within +/-7 units, not the large deviations I'm seeing.
When I move the board, the readings for X, Y, and Z change as expected, which further puzzles me about these unexpected steady-state peaks. Are such peaks normal under these settings, or is there a potential issue I should be looking into?
Thank you for your insights.
Solved! Go to Solution.
2023-12-14 11:03 PM
The problem was intermittent and didn't happen often. However, when I applied a debugger at the moment the problem finally occurred, I noticed that the high byte was toggling between values when a peak occurred.
Once I saw this, the problem became clear. It had something to do with reading the registers while the output registers were updating.
Although the BDU bit was correctly set, there was another issue in the code. I also needed to set the IF_ADD_INC bit and send an additional 8 clock pulses to the SPI to read the entire 16 bits at once.
Now, everything is working perfectly!
2023-12-11 08:00 AM
Hi @sde c.1 ,
Have you enabled the BDU bit in reg 21h?
2023-12-11 11:56 PM
BDU is set.
It seems that most of the times there are no issues, and somethimes i see these spikes.
Maybe this can be vibration that i cannot feel myself...
2023-12-12 02:35 AM
Hi @sde c.1 ,
Yes, it seems a disturbance. Try to keep the device in an environment as isolated as possible.
2023-12-14 11:03 PM
The problem was intermittent and didn't happen often. However, when I applied a debugger at the moment the problem finally occurred, I noticed that the high byte was toggling between values when a peak occurred.
Once I saw this, the problem became clear. It had something to do with reading the registers while the output registers were updating.
Although the BDU bit was correctly set, there was another issue in the code. I also needed to set the IF_ADD_INC bit and send an additional 8 clock pulses to the SPI to read the entire 16 bits at once.
Now, everything is working perfectly!