diff options
| author | James Munns <[email protected]> | 2024-08-24 10:21:29 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-08-24 10:21:29 +0000 |
| commit | 545eb39819d792829dfbae37b44208d09a530547 (patch) | |
| tree | 8f7db0191126b277aea9b77e499b3fcd383ba6a6 | |
| parent | 423e5d7655d038ead9ad7f5f448cabbd0b330660 (diff) | |
| parent | 8c1024b2a59c82ffccaba0327c02bc99da047943 (diff) | |
Merge pull request #3279 from ionspin/fix-timer0-tick
Set up timer0 tick when initializing clocks
| -rw-r--r-- | embassy-rp/src/clocks.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/embassy-rp/src/clocks.rs b/embassy-rp/src/clocks.rs index 5f7ba10e2..ed146844c 100644 --- a/embassy-rp/src/clocks.rs +++ b/embassy-rp/src/clocks.rs | |||
| @@ -512,12 +512,18 @@ pub(crate) unsafe fn init(config: ClockConfig) { | |||
| 512 | w.set_int(config.ref_clk.div); | 512 | w.set_int(config.ref_clk.div); |
| 513 | }); | 513 | }); |
| 514 | 514 | ||
| 515 | // Configure tick generation on the 2040. On the 2350 the timers are driven from the sysclk. | 515 | // Configure tick generation on the 2040. |
| 516 | #[cfg(feature = "rp2040")] | 516 | #[cfg(feature = "rp2040")] |
| 517 | pac::WATCHDOG.tick().write(|w| { | 517 | pac::WATCHDOG.tick().write(|w| { |
| 518 | w.set_cycles((clk_ref_freq / 1_000_000) as u16); | 518 | w.set_cycles((clk_ref_freq / 1_000_000) as u16); |
| 519 | w.set_enable(true); | 519 | w.set_enable(true); |
| 520 | }); | 520 | }); |
| 521 | // Configure tick generator on the 2350 | ||
| 522 | #[cfg(feature = "_rp235x")] | ||
| 523 | { | ||
| 524 | pac::TICKS.timer0_cycles().write(|w| w.0 = clk_ref_freq / 1_000_000); | ||
| 525 | pac::TICKS.timer0_ctrl().write(|w| w.set_enable(true)); | ||
| 526 | } | ||
| 521 | 527 | ||
| 522 | let (sys_src, sys_aux, clk_sys_freq) = { | 528 | let (sys_src, sys_aux, clk_sys_freq) = { |
| 523 | use {ClkSysCtrlAuxsrc as Aux, ClkSysCtrlSrc as Src}; | 529 | use {ClkSysCtrlAuxsrc as Aux, ClkSysCtrlSrc as Src}; |
