-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
sensors: Introduce async workflow #57962
sensors: Introduce async workflow #57962
Conversation
@teburd @MaureenHelm @asemjonovs @tristan-google this PR is fully functional, it's just missing documentation AFAICT. Please review, docs will come in a few hours. If context is needed, #56963 contains the full stack of changes including streaming support and Al's icm driver changes. |
1689e90
to
f6f33a1
Compare
f806ee7
to
037156e
Compare
Added the documentation |
Since there is this:
Can you perform a before and after build of a simple sensor sample (not accelerometer based, https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/sensor/bme280 would be good if converted) and post the flash and RAM of both builds? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do some poking around today and play around with the shell sample, really happy to see.
286863f
to
7c98123
Compare
54d0096
to
821972c
Compare
821972c
to
e368464
Compare
e368464
to
ac1d0ec
Compare
Improve clang-format handling for iterable sections. Signed-off-by: Yuval Peress <peress@google.com>
Add a new async API based on the RTIO subsystem. This new API allows: 1. Users to create sampling configs (telling the sensor which channels they want to sample together). 2. Sample data in an asynchronous manner which provides greater control over the data processing priority. 3. Fully backwards compatible API with no driver changes needed for functionality (they are needed to improve performance). 4. Helper functions for processing loop. Signed-off-by: Yuval Peress <peress@google.com>
Update the sensor shell logic to use the new sensor_read() APIs and make triggers an option of the sensor_shell sample (this avoids the trigger stealing the interrupt status from one-shot reads). Signed-off-by: Yuval Peress <peress@google.com>
Always clearing the interrupt status register was causing issues for the sensor shell when interrupts were enabled but trying to read one-off samples. Signed-off-by: Yuval Peress <peress@google.com>
Add documentation about the new async read and decode APIs including some rough examples. Signed-off-by: Yuval Peress <peress@google.com>
ac1d0ec
to
67c041b
Compare
Second force push is a rebase because of a merge conflict in drivers/sensor/CMakeLists.txt |
@yperess As far as I can tell the sensor shell now requires the async API even for sensors that do not support it. |
The async API wraps the existing one so there's no need to do anything. As drivers start to implement it, you'll see a small performance gain. The only catch is if you enable the shell, you need to enable the async API flag but every sensor should work as usual. If you run into an issue with a specific sensor please let me know. |
The Problem for us is that the async API pulls in the RTIO system. At least by default this increases our RAM usage by around 4.5KB, which we can not afford on our 32KB RAM device. |
Can you please file an issue with west build -t ram_report showing the relevant sections? Very little ram is actually required for rtio, the mempool might the issue at hand here |
This here is the only major difference in the RAM report. The Only change in my prj.conf is
|
The block, sqe, and cqe pools can be made much much smaller here. The rest (channel name related stuff) I believe is needed for the shell auto complete. I'd accept patches to making the default sizes here more sensible for smaller devices. This could be as small as 1 sq, 1 cq, and a mempool with one block sized to fit your sensor data. To me this is a bug and a fix in 3.4 would be sensible. @yperess any thoughts? |
Introduces a new workflow for sensors involving getting raw sensor data via RTIO and allowing for processing to be done by an application controlled thread via the decoder API.