Skip to content

Conversation

@teburd
Copy link
Contributor

@teburd teburd commented Mar 2, 2023

Many changes in this RFC PR are very unlikely to make it upstream as-is or perhaps ever but as a practical demonstration for how RTIO could be used with a sensor, on a spi bus it does just that.

The sample app itself (samples/boards/tdk_robokit1) shows how delays may result in buffer underruns/overruns (depending on the perspective!), and how they may be resolved by having more buffers to feed the demand of the sensor. It would be interesting to also consider a throughput/latency comparison... lots of small buffers vs a few large ones.

It also lets you build with and without CONFIG_SPI_RTIO to show how thread stacks might be saved by using RTIO with SPI. Once #55178 is merged I'll rebase again and we can do probably even more compare/contrasts to get a sense of things.

This builds on top of #55382

@teburd teburd force-pushed the tdk_icm42688p_rtio_spi2 branch 8 times, most recently from 1071d7d to 35d637e Compare March 8, 2023 15:49
@teburd
Copy link
Contributor Author

teburd commented Mar 8, 2023

Patch set is mostly cleaned up now and worth perusing for criticisms and such.

@teburd teburd force-pushed the tdk_icm42688p_rtio_spi2 branch 7 times, most recently from 162fa6f to 1f48b88 Compare March 17, 2023 17:51
@teburd teburd mentioned this pull request Mar 22, 2023
Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some nitpicky comments, but overall this looks very cool!

const struct sensor_driver_api *api =
(const struct sensor_driver_api *)dev->api;

return api->fifo_iodev(dev, iodev);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to check if fifo_iodev is NULL

#
# SPDX-License-Identifier: Apache-2.0

DT_COMPAT_ICM42688 := invensense,icm42688
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most (all?) of these have been removed. Is this a rebasing mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost certainly

@teburd teburd mentioned this pull request Mar 23, 2023
19 tasks
Provides the necessary APIs to stream a sensors FIFO using RTIO

Adds an API call to enable explicitly reading the fifo from the sensor
at any time. The thinking is that while the sensors gpio trigger might
be one source of triggering a fifo read, external sources should be
possible.

Signed-off-by: Tom Burdick <[email protected]>
@teburd teburd force-pushed the tdk_icm42688p_rtio_spi2 branch from 1f48b88 to 2a87239 Compare April 3, 2023 16:32
teburd added 3 commits April 3, 2023 11:36
An experimental idea to enable streaming fifo data from the sensor using
RTIO with the existing sensor API. A sensor reader could easily be built on
top of the buffer to produce meaningful values.

There are many ways this can be built currently. Using either the existing
trigger work context (system workqueue or own thread) when SPI_RTIO=n or
using a sequence. With or without SPI_SAM_DMA (where only polling SPI
transfers are used).

This is a really nice setup to explore and experiment with RTIO, SPI, and
a really fast sensor.

Signed-off-by: Tom Burdick <[email protected]>
Provides a sample demonstrating the fast sensor on a tdk robokit1 used
with and without RTIO.

With RTIO the sample may be built with SPI_RTIO enabled or disabled to
get a sense of the cost of a filler thread when SPI does not support RTIO
as well.

Signed-off-by: Tom Burdick <[email protected]>
While an asynchronous transfer is on going for the 6 axis imu, concurrently
read the magnetometer with its blocking fetch call.

In the future it'd be nice to have the magnetometer also work with RTIO
driven by a timer. In fact having all the sensors read on a timer would be
incredibly nice to showcase.

Signed-off-by: Tom Burdick <[email protected]>
@teburd teburd force-pushed the tdk_icm42688p_rtio_spi2 branch from 2a87239 to a82d297 Compare April 3, 2023 16:36
@teburd teburd requested a review from golowanow April 20, 2023 16:13
@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Jun 20, 2023
@github-actions github-actions bot closed this Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants