Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Documentation/components/drivers/special/sensors/lsm6ds3trc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,42 @@ sensor, read in the same burst transaction as whichever sub-sensor's
sample triggered it -- it does not have an independent output data rate
of its own in this driver.

FIFO mode
=========

Setting ``CONFIG_SENSORS_LSM6DS3TRC_FIFO=y`` switches interrupt-driven
delivery from one uORB event per data-ready interrupt to draining the
chip's hardware FIFO on a watermark interrupt instead -- one interrupt and
one I2C burst read per
``CONFIG_SENSORS_LSM6DS3TRC_FIFO_WATERMARK`` samples, rather than per
sample. This cuts interrupt and I2C-wakeup frequency roughly by the
watermark size, at the cost of three limitations while it's on:

- Both the accelerometer and gyroscope are forced to the same output
data rate. Whichever sub-sensor activates first sets it; a second
subscriber joins that rate instead of using its own.
- Per-sample temperature isn't available -- the FIFO pattern doesn't
include it. One direct temperature read happens per drain and is
applied to every sample in that batch instead.
- The chip's FIFO write trigger only fires while both the accelerometer
and the gyroscope are physically running, even if only one of them is
actually subscribed. This driver forces the unsubscribed sub-sensor
on at the shared rate to make the FIFO work at all -- it's still left
out of the FIFO pattern itself, so this doesn't cost extra I2C
bandwidth on drain, but it does mean FIFO mode cannot power down the
unused sub-sensor the way non-FIFO interrupt-driven mode can.

.. warning::
``CONFIG_SENSORS_LSM6DS3TRC_FIFO_WATERMARK`` is in samples, not raw
FIFO words, but it must not exceed
``CONFIG_SENSORS_LSM6DS3TRC_ACCEL_ORB_BUFSIZE`` or
``CONFIG_SENSORS_LSM6DS3TRC_GYRO_ORB_BUFSIZE`` -- a single drain can
push that many events into each topic's uORB ring buffer at once, and
a smaller buffer drops the oldest ones.

FIFO mode only takes effect in interrupt-driven mode (a real ``attach()``
in ``lsm6ds3trc_config_s``); it's silently unused in kthread polling mode.

This sensor also has an additional command for gaining access to extra
functionality.

Expand Down
33 changes: 31 additions & 2 deletions drivers/sensors/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1083,8 +1083,8 @@ config SENSORS_LSM6DS3TRC
Enable uORB driver support for the STM LSM6DS3TR-C 6-axis IMU
over I2C. Needs the high-priority work queue even in kthread
polling mode: the driver's interrupt handlers reference it
unconditionally (they're only dead code until a future phase wires
up INT1/INT2).
unconditionally, whether or not a board actually wires up INT1
to use them.

if SENSORS_LSM6DS3TRC

Expand Down Expand Up @@ -1115,6 +1115,35 @@ config SENSORS_LSM6DS3TRC_GYRO_ORB_BUFSIZE
---help---
The circular buffer size for the gyroscope uORB measurements

config SENSORS_LSM6DS3TRC_FIFO
bool "LSM6DS3TR-C FIFO drain (interrupt mode only)"
default n
---help---
Drain the chip's hardware FIFO on a watermark interrupt instead of
pushing one uORB event per physical sample on every data-ready
interrupt. Cuts the number of I2C transactions and interrupt
wakeups by roughly the watermark size, at the cost of both
sub-sensors being forced to the same output data rate while this
is on (whichever one is activated first sets it; the other joins
it) and per-sample temperature (the FIFO pattern doesn't include
it; one direct temperature read per drain is applied to the whole
batch instead). Only takes effect when the board registers this
driver with a real interrupt attach() -- it's silently unused in
kthread polling mode.

config SENSORS_LSM6DS3TRC_FIFO_WATERMARK
int "LSM6DS3TR-C FIFO watermark (samples)"
default 8
range 1 300
depends on SENSORS_LSM6DS3TRC_FIFO
---help---
How many samples (not raw FIFO words) accumulate before the FIFO
threshold interrupt fires and a drain happens. Keep this at or
below CONFIG_SENSORS_LSM6DS3TRC_ACCEL_ORB_BUFSIZE and
CONFIG_SENSORS_LSM6DS3TRC_GYRO_ORB_BUFSIZE -- one drain can push
up to this many events into each topic's uORB ring buffer in a
single burst, and a smaller ring buffer will drop the oldest ones.

endif # SENSORS_LSM6DS3TRC

config SENSORS_LSM9DS1
Expand Down
Loading
Loading