Merge pull request #3279 from ionspin/fix-timer0-tick

Set up timer0 tick when initializing clocks
This commit is contained in:
James Munns 2024-08-24 10:21:29 +00:00 committed by GitHub
commit 545eb39819
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -512,12 +512,18 @@ pub(crate) unsafe fn init(config: ClockConfig) {
w.set_int(config.ref_clk.div);
});
// Configure tick generation on the 2040. On the 2350 the timers are driven from the sysclk.
// Configure tick generation on the 2040.
#[cfg(feature = "rp2040")]
pac::WATCHDOG.tick().write(|w| {
w.set_cycles((clk_ref_freq / 1_000_000) as u16);
w.set_enable(true);
});
// Configure tick generator on the 2350
#[cfg(feature = "_rp235x")]
{
pac::TICKS.timer0_cycles().write(|w| w.0 = clk_ref_freq / 1_000_000);
pac::TICKS.timer0_ctrl().write(|w| w.set_enable(true));
}
let (sys_src, sys_aux, clk_sys_freq) = {
use {ClkSysCtrlAuxsrc as Aux, ClkSysCtrlSrc as Src};