2025-10-01 11:14 AM
Hi,
I am trying to capture data from the IIS3DWB sensor at its maximum rate and save it into a buffer of length 8192 (due to internal RAM limitations). I'm using SPI with DMA to interface with the sensor. However, I'm not able to capture the data correctly — the X-axis shows incorrect values, while the Y and Z axes remain constant. I tested with another sensor, but the issue persists. The FIFO is configured to stream mode. I haven't detected any buffer overflows. I'm attaching the code and a CSV file for reference.
SETTINGS: SPI clock-8MHz, iis3dwb stores data in FIFO in continuous mode with 26.67k ODR , 3-axis mode is used, timestamp batch to FIFO is on, BDU is on, 16G range mode is on, IRQ pin -not connected, using polling mode.
can anyone give me solution.
Thanks
2025-10-07 2:43 AM
Hi @ajaya_kumar ,
You have enabled timestamp batch with iis3dwb_fifo_xl_batch_set(&dev_ctx, IIS3DWB_XL_BATCHED_AT_26k7Hz);
This means every N samples, 3 bytes of timestamp data are inserted into the FIFO stream. Your current parsing assumes all FIFO entries are 6-byte accelerometer samples, but with timestamp batch enabled, some entries are 9 bytes (6 accel + 3 timestamp).
This mismatch causes misalignment in reading axis data.
The SAMPLE_COUNT
should reflect the number of FIFO entries, not just accelerometer samples, because timestamp batches occupy FIFO space.
The actual number of accelerometer samples will be fewer than SAMPLE_COUNT
if timestamp batching is enabled.
To simplify debugging, temporarily disable timestamp batching: this will make all FIFO entries pure accelerometer samples (6 bytes each), so your current parsing logic will work correctly.