Skip to content

STM32F1 Time Driver#681

Merged
mattnite merged 3 commits intoZigEmbeddedGroup:mainfrom
RecursiveError:stm32_time
Sep 27, 2025
Merged

STM32F1 Time Driver#681
mattnite merged 3 commits intoZigEmbeddedGroup:mainfrom
RecursiveError:stm32_time

Conversation

@RecursiveError
Copy link
Collaborator

@RecursiveError RecursiveError commented Sep 21, 2025

RTC and GP-Timer time driver for the STM32F1xx

Bug fix:

  • HSE/128 is now configured correctly.

}
}

pub fn get_time_since_boot() time.Absolute {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In Embassy, interrupts are commonly used to extend counter size by incrementing a variable on each event. This approach is mostly relevant for general-purpose timers.

For the RTC, however, this extension is unnecessary. On ST chips, the RTC is already implemented with two cascaded counters: the RTC clock (RTC_CLK) feeds the prescaler counter (TR_CLK), which on overflow increments the RTC counter (RTC_CNT). Together, they provide a 52-bit counter.

This driver does not take advantage of the full 52 bits, since even the RTC_CNT counting in seconds would take many years to overflow.

@RecursiveError RecursiveError changed the title STM32 Time Driver STM32F1 Time Driver Sep 22, 2025
@RecursiveError RecursiveError marked this pull request as ready for review September 26, 2025 00:15
@mattnite mattnite merged commit 3c6fa37 into ZigEmbeddedGroup:main Sep 27, 2025
88 of 90 checks passed
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.

2 participants