Skip to content

Conversation

@Ragarnoy
Copy link
Contributor

@Ragarnoy Ragarnoy commented Nov 25, 2025

I recently needed an RTC, thought that the RP2350 didn't have one, but it actually does and has something that's kind of better (depending on your use case). This is my shot at implementing it.

Changes

AON Timer:

  • 64-bit millisecond counter (1 kHz resolution)
  • Configurable clock sources (XOSC/LPOSC)
  • Alarm wake modes: WFI/WFE, DORMANT, or both
  • Async alarm waiting with interrupts

DateTime module:

  • Moved datetime types from RTC to shared embassy-rp/src/datetime/ module
  • Works with both RTC (RP2040) and AON Timer (RP2350)
  • Supports chrono or standalone implementation
  • Added Unix epoch conversion (ms since 1970-01-01)

AON Timer DateTime API:

  • set_datetime(), now_as_datetime(), set_alarm_at_datetime()

I did not implement the time driver because the 1ms resolution is too low for a main timer. This works better as a simple "global" clock for waking from dormant (feel free to change my mind on this i'm not 100% convinced)

I also was too lazy to have an example that wakes from dormant state. I'm not sure there is a way to enable dormant state through embassy right now

(tested on actual RP2350 hardware)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant