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

From: Lorenzo Bianconi
Date: Fri Oct 10 2025 - 09:15:49 EST


On Oct 10, Francesco Lavra wrote:
> 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.

ack, now I got the goal of the series. I think the series is mostly fine.
I guess hwfifo_odr instead of bdr is more meaningful, what do you think?
Naming is always hard.

Regards,
Lorenzo

Attachment: signature.asc
Description: PGP signature