Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtio: Real-Time Stream and Sensor API #17434

Closed
wants to merge 6 commits into from

Conversation

teburd
Copy link
Collaborator

@teburd teburd commented Jul 9, 2019

A DMA friendly Stream API for zephyr.

Provides a way to define a driver which provides an output FIFO of
blocks. Blocks are allocated from a specified block allocator. These blocks are
easily used for DMA transfers.

Some convenience functions for storing and retrieving primitive types
in the blocks is provided.

Blocks are meant to be placed into the output fifo based on a policy
describing time or number of entries since the block began being filled. If
the block is full it is meant to be immediately pushed into the FIFO.

The use case in mind is high rate sensors with hardware FIFOs and SPI
interfaces where DMA transfers from these sensors would save a great
deal of CPU time avoiding the high rate of interrupts and small SPI
transfers that would otherwise occur. Other uses are certainly possible,
I imagine audio and video have similar requirements.

For sensors an added interface to iterate over sample sets from a block is provided allowing for lazily converting sample set values into numerical values of varying types. To start only float is available but certainly the current sensor_value (int/int pair), cmsis-dsp friendly q value types, or other numerical formats could be provided.

@zephyrbot zephyrbot added area: API Changes to public APIs area: Tests Issues related to a particular existing or missing test labels Jul 9, 2019
@zephyrbot
Copy link
Collaborator

zephyrbot commented Jul 9, 2019

All checks are passing now.

Review history of this comment for details about previous failed status.
Note that some checks might have not completed yet.

Copy link
Contributor

@dbkinder dbkinder left a comment

Choose a reason for hiding this comment

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

Doesn't this new rtio API need documentation (as ZIO previously did)?

@teburd
Copy link
Collaborator Author

teburd commented Jul 11, 2019

@dbkinder it does, though I'm still working out how things work, so far everyone involved has been ok with this situation while its in the topic branch not yet in master, when the PR for master happens it'll have docs

@teburd teburd force-pushed the rtio branch 3 times, most recently from 3861443 to 30cdbee Compare July 12, 2019 01:44
@teburd
Copy link
Collaborator Author

teburd commented Jul 12, 2019

@dbkinder I added some initial documentation this time as I think its important and you are right, I will continue to add to it as this progresses

@dbkinder
Copy link
Contributor

Alas, you've tripped on a known issue in our API documentation processing around nested unnamed unions in a struct (don't ask). You can document this as a "known issue" (and remove the reported documentation error) by adding a file to your PR .known-issues/doc/rtio.conf in the zephyr base directory, with this content (you'll find some other of these .conf files there for other "known issues"):

#
# RTIO
#
#
# include/rtio.h warnings
#
^(?P<filename>([\-:\\/\w\.])+[/\\]doc[/\\]reference[/\\]peripherals[/\\]rtio.rst):(?P<lineno>[0-9]+): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
^[ \t]*
^[ \t]*\^
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected identifier in nested name. \[error at [0-9]+]
^[ \t]*
^[ \t]*\^
^(?P=filename):(?P=lineno): WARNING: Invalid definition: Expected end of definition. \[error at [0-9]+]
^.*rtio_trigger_config.options
^[- \t]*\^
#

@teburd teburd force-pushed the rtio branch 4 times, most recently from 47d5fd4 to d9ab09e Compare July 16, 2019 16:12
@teburd
Copy link
Collaborator Author

teburd commented Jul 16, 2019

@dbkinder I believe everything is sorted now

Copy link
Contributor

@dbkinder dbkinder left a comment

Choose a reason for hiding this comment

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

Some recommended writing edits and we're good to go.

doc/reference/peripherals/rtio.rst Outdated Show resolved Hide resolved
doc/reference/peripherals/rtio.rst Outdated Show resolved Hide resolved
doc/reference/peripherals/rtio.rst Outdated Show resolved Hide resolved
doc/reference/peripherals/rtio.rst Outdated Show resolved Hide resolved
Adds a layer of sensor value decoding on top of the RTIO streaming
API to provide physical measurement values in useful numerical
formats and units.

Signed-off-by: Tom Burdick <tom.burdick@electromatic.us>
@teburd teburd changed the title rtio: Real-Time Stream API rtio: Real-Time Stream and Sensor API Dec 5, 2019
@teburd teburd force-pushed the rtio branch 3 times, most recently from fe3303c to ca0795f Compare January 5, 2020 22:37
Copy link
Collaborator

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

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

please update to use find_package(Zephyr)

# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Before going in, this should be updated to find_package(Zephyr)

Suggested change
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})

# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please update to find_package(Zephyr)

Suggested change
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})

# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please update to find_package(Zephyr)

Suggested change
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})

@teburd
Copy link
Collaborator Author

teburd commented May 19, 2020

If I get back to this I'll reopen, but I've personally run out of mental energy on this for the time being, and the product it was being made for is on indefinite hold at the moment

@teburd teburd closed this May 19, 2020
@gmarull
Copy link
Member

gmarull commented Aug 23, 2020

@BFrog I'd really like to see the RTIO API moving. At a first glance it looks quite complete and well thought, so I wonder what is missing or left to do. I'm currently developing an application where I need to read data efficiently from an IMU using its FIFO, so I could help on testing and implementing at least a sensor driver.

@teburd
Copy link
Collaborator Author

teburd commented Aug 26, 2020

@gmarull at this point it needs to be rebased and all the issues fixed, there needs to be automated tests written, and probably most of all a complete working driver put in to showcase the usage. All of those things were in progress but as mentioned in a previous comment for various reasons I've paused on this. I'd be happy to continue working on it, especially if someone is looking to fund the work as it really is not something easily done on the side in my opinion. If someone else wants to take over the work is here and easily forked, I'd be happy to review and assist in understanding any of my thinking or reasoning.

@adamfowleruk
Copy link

Hi all. We're in the process of finishing a Herald analysis API. One of the future sources of data will be raw sensor data on devices running Zephyr RTOS. This proposed API in this PR would match very well as a 'Source' for our analysis API. Who can I talk to about progressing this Zephyr API please? Happy to help test it out on my range of devices and sensors here.

In particular we will be sourcing temperature, pulse rate/blood ox, ambient light sensors via I2C from an nRF52833. Our mid-level analysis framework (initial use - digital contact tracing exposure risk calculation for COVID-19/Ebola) can be found here for reference: https://github.com/adamfowleruk/herald-for-cpp/blob/0c6d8ba0067f2324cae8563df13834f727577a3a/herald-tests/analysisrunner-tests.cpp#L150

@teburd
Copy link
Collaborator Author

teburd commented Apr 5, 2021

@adamfowleruk happy to discuss how we might get this moving forward again, I set it down due to a lack of time as I started other, new projects with other companies.

Happy to pick it up again or help guide others as I mentioned in previous comments. I know @gmarull was also interested in seeing this move forward.

@gmarull
Copy link
Member

gmarull commented Apr 6, 2021

I'd really like to see rtio moving forward, unfortunately I can only help on review/testing right now as I'm busy with other things.

@avisconti
Copy link
Collaborator

I'm also interested in see this things getting go again.

@henrikbrixandersen
Copy link
Member

+1 from here as well.

@adamfowleruk
Copy link

I may have time to look at this over the next month. We now have prototype wearable hardware and so will revisit this soon.

@teburd
Copy link
Collaborator Author

teburd commented Jul 20, 2021

I'm happy to hear there's interest in this, maybe a first step on my part would be to rebase it to 2.6 and get it compiling

@adamfowleruk
Copy link

@BFrog That'd be great, thanks. If you have any time I'd love to pair with you over zoom to understand what is there now.

@martinjaeger martinjaeger mentioned this pull request Sep 17, 2021
4 tasks
@teburd
Copy link
Collaborator Author

teburd commented Oct 1, 2021

its building again and you can run the ramp_throughput sample, its not PR ready though and might take some time to get there still, happy to discuss on discord

https://github.com/teburd/zephyr/tree/v2.7-rtio

@teburd teburd moved this from In progress to Done in Sensors Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: Documentation area: Samples Samples area: Sensors Sensors area: Tests Issues related to a particular existing or missing test DNM This PR should not be merged (Do Not Merge) RFC Request For Comments: want input from the community
Projects
No open projects
Sensors
  
Done
Development

Successfully merging this pull request may close these issues.

None yet