Re: [PATCH 2/2] iio: imu: st_lsm6dsx: Decouple sensor ODR from FIFO batch data rate

Francesco Lavra
2025-10-10T09:28:28Z

[-- Attachment #1: Type: text/plain, Size: 1852 bytes --]

On Fri, 2025-10-10 at 10:13 +0200, Lorenzo Bianconi wrote:
> > On Fri, 2025-10-10 at 00:30 +0200, Lorenzo Bianconi wrote:
> > > > The rate at which accelerometer or gyroscope sensor samples are fed
> > > > to the hardware FIFO (batch data rate, or BDR) does not have to
> > > > coincide with the sensor sampling frequency (output data rate, or
> > > > ODR); the only requirement is for the BDR to not be greater than
> > > > the ODR. Having a BDR lower than the ODR is useful in cases where
> > > > an application requires a high sampling rate for accurate detection
> > > > of motion events (e.g. wakeup events), but wants to read sensor
> > > > sample values from the device buffer at a lower data rate.
> > >
> > > can you please provide more details here? Are you using the hw fifo
> > > to
> > > read
> > > data? If we configure the hw fifo according to the BDR (even assuming
> > > the
> > > watermark is set 1) the hw will generate interrupts according to the
> > > BDR
> > > (bdr < odr).
> >
> > Yes, I'm using the hw fifo to read data. The use case is to enable
> > event
> > detection (which works best at high sampling rates) and sensor data
> > streaming at the same time, without requiring the data stream to be at
> > the
> > same rate as the sensor sampling rate. So the amount of I2C (or SPI)
> > traffic (as well as the rate of periodic interrupts) required by the
> > data
> > stream is kept to a minimum without sacrificing the accuracy of event
> > detection.
>
> I guess you can get the same result (reduce sensor data interrupt rate
> keeping high odr value) configuring the hw fifo watermark.
> Does it work for you?

Setting the hw fifo watermark to a high value reduces the rate of
interrupts, but doesn't do much to reduce the amount of I2C traffic, so the
issue would still be there.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 659 bytes --]