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?
Solved! Go to Solution.
2026-02-03 6:03 PM
You mentioned in the following topic
Solved: ASM330LHH Frequency Measurement using the mother U... - STMicroelectronics Community
“keep in mind that it will be asynchronous, so you could loose some data” would that be “an inconsistent sample”?
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.
2026-02-03 5:49 PM
My apologies. I omitted an important detail.
The device is the ASM330LHH.
When starting a timer on the microcontroller and using that timer to read data from the ASM330LHH via SPI, I want to understand the situation that could occur if the ASM330LHH's sample data update timing coincides with the microcontroller's SPI communication data read timing.
2026-02-03 6:03 PM
You mentioned in the following topic
Solved: ASM330LHH Frequency Measurement using the mother U... - STMicroelectronics Community
“keep in mind that it will be asynchronous, so you could loose some data” would that be “an inconsistent sample”?
2026-02-03 6:09 PM
Thank you very much. It will be very useful.