2026-02-03 12:37 AM - last edited on 2026-02-03 6:14 AM by Andrew Neil
The microcontroller acquires data via SPI communication with the accelerometer. What is the risk if the data update timing of the accelerometer and the data acquisition timing of the microcontroller overlap?
2026-02-03 2:27 AM
Hi @ggob ,
If the accelerometer updates its output registers at the same time the microcontroller is reading them over SPI, the main risk is that you get an inconsistent sample, not physical damage.
To mitigate this effect you could:
2026-02-03 3:00 AM
The risk is corrupted data, which will result in 0 data or some random numbers. An example would be unprotected memory pools, which are accessed by the MCU and the DMA.
What would I do in your position?
Build your system with a double buffered DMA with a timer as trigger to fetch the data. Use the callbacks to have an interrupt, when the buffer is half full, zero copy the data into a regular buffer in RAM and then proceed. You will need proper MPU or dedicated cache maintainance, depending on your MCU.
As reward you get a system with minimal overhead, reliable data stream and maximum performance.
2026-02-03 6:11 AM
You need to be more specific. What accelerometer? What does the datasheet say about it?
Chips often have protections against reading out mismatched data.