RP235x: add selectable Embassy time driver backends (TIMER1, AON/POWMAN, and RISC-V mtime) - #6733
Conversation
…timer1-and-time-driver-aot
|
This pull request is a draft, so it isn't in the review queue yet. Mark it as ready for review when you'd like someone to look at it. |
|
in embassy-rp/Cargo.toml: |
|
@Dirbaio also see #3847 |
|
From the conversation last year: IMHO, the hardware design of the 2350 suggest intended use of the Platform Timer for thread scheduling purpose. Hence TODO with feature managing:
|
Summary
This PR extends the RP235x time driver implementation in Embassy RP to support multiple timer backends behind feature flags, while preserving the existing default behavior.
Compared to origin/main, this branch contains 11 commits and updates 2 files:
Motivation
On RP235x, different low-power and execution scenarios benefit from different timer sources. This change enables selecting the time driver backend explicitly, instead of always using TIMER0.
What Changed
Added new feature flags in embassy-rp/Cargo.toml:
Refactored backend selection in embassy-rp/src/time_driver.rs:
Implemented backend-specific time read and alarm logic:
Added backend-specific init and interrupt wiring:
Added RP235x AON helper module:
Compatibility and Behavior
Notes
The Cargo feature declarations are currently added directly in embassy-rp as an interim step to make backend selection possible in this branch.
Testing
TODO
Decent integration with the existing cargo feature system (see comment below )
Optimal resource use, maybe easiest for the user, just a single additional cargo feature ("low-power-timer") necessary:
default: use the Platform Timer (same 1µS resolution as with 2040) => both TIMER0 and TIMER1 are free for the user project.
optional: (feature "low-power-timer") use the AON Timer (1mSec resolution) => extreme low power