aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-nrf/src')
-rw-r--r--embassy-nrf/src/lib.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs
index 530964107..bc386e820 100644
--- a/embassy-nrf/src/lib.rs
+++ b/embassy-nrf/src/lib.rs
@@ -285,6 +285,15 @@ pub use crate::pac::NVIC_PRIO_BITS;
285pub mod config { 285pub mod config {
286 //! Configuration options used when initializing the HAL. 286 //! Configuration options used when initializing the HAL.
287 287
288 /// Clock speed
289 #[cfg(feature = "_nrf54l")]
290 pub enum ClockSpeed {
291 /// Run at 128 MHz.
292 CK128,
293 /// Run at 64 MHz.
294 CK64,
295 }
296
288 /// High frequency clock source. 297 /// High frequency clock source.
289 pub enum HfclkSource { 298 pub enum HfclkSource {
290 /// Internal source 299 /// Internal source
@@ -554,6 +563,8 @@ pub mod config {
554 pub time_interrupt_priority: crate::interrupt::Priority, 563 pub time_interrupt_priority: crate::interrupt::Priority,
555 /// Enable or disable the debug port. 564 /// Enable or disable the debug port.
556 pub debug: Debug, 565 pub debug: Debug,
566 #[cfg(feature = "_nrf54l")]
567 pub clock_speed: ClockSpeed,
557 } 568 }
558 569
559 impl Default for Config { 570 impl Default for Config {
@@ -594,6 +605,8 @@ pub mod config {
594 debug: Debug::NotConfigured, 605 debug: Debug::NotConfigured,
595 #[cfg(not(feature = "_ns"))] 606 #[cfg(not(feature = "_ns"))]
596 debug: Debug::Allowed, 607 debug: Debug::Allowed,
608 #[cfg(feature = "_nrf54l")]
609 clock_speed: ClockSpeed::CK64,
597 } 610 }
598 } 611 }
599 } 612 }
@@ -700,6 +713,23 @@ pub fn init(config: config::Config) -> Peripherals {
700 #[allow(unused_mut)] 713 #[allow(unused_mut)]
701 let mut needs_reset = false; 714 let mut needs_reset = false;
702 715
716 // set clock speed
717 #[cfg(feature = "_nrf54l")]
718 {
719 #[cfg(feature = "_s")]
720 let regs = pac::OSCILLATORS_S;
721 #[cfg(feature = "_ns")]
722 let regs = pac::OSCILLATORS_NS;
723
724 use pac::oscillators::vals::Freq;
725 regs.pll().freq().write(|w| {
726 w.set_freq(match config.clock_speed {
727 config::ClockSpeed::CK64 => Freq::CK64M,
728 config::ClockSpeed::CK128 => Freq::CK128M,
729 });
730 });
731 }
732
703 // Workaround used in the nrf mdk: file system_nrf91.c , function SystemInit(), after `#if !defined(NRF_SKIP_UICR_HFXO_WORKAROUND)` 733 // Workaround used in the nrf mdk: file system_nrf91.c , function SystemInit(), after `#if !defined(NRF_SKIP_UICR_HFXO_WORKAROUND)`
704 #[cfg(all(feature = "_nrf91", feature = "_s"))] 734 #[cfg(all(feature = "_nrf91", feature = "_s"))]
705 { 735 {