From 67ba38e1966a934517ceb641b2dcd4c1c68c02ee Mon Sep 17 00:00:00 2001 From: Ole Bauck Date: Sun, 31 Aug 2025 09:27:47 +0200 Subject: nrf54l: Disable glitch detection and enable DC/DC in init. --- embassy-nrf/CHANGELOG.md | 2 ++ embassy-nrf/src/lib.rs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/embassy-nrf/CHANGELOG.md b/embassy-nrf/CHANGELOG.md index 4e0887b0d..5dc941b25 100644 --- a/embassy-nrf/CHANGELOG.md +++ b/embassy-nrf/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased - ReleaseDate +- changed: nrf54l: Disable glitch detection and enable DC/DC in init. + ## 0.7.0 - 2025-08-26 - bugfix: use correct analog input SAADC pins on nrf5340 diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index 2b72debeb..aa4801897 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs @@ -707,6 +707,14 @@ pub fn init(config: config::Config) -> Peripherals { } } + // GLITCHDET is only accessible for secure code + #[cfg(all(feature = "_nrf54l", feature = "_s"))] + { + // The voltage glitch detectors are automatically enabled after reset. + // To save power, the glitch detectors must be disabled when not in use. + pac::GLITCHDET.config().write(|w| w.set_enable(false)); + } + // Setup debug protection. #[cfg(not(feature = "_nrf51"))] match config.debug { @@ -1083,6 +1091,15 @@ pub fn init(config: config::Config) -> Peripherals { reg.vregradio().dcdcen().write(|w| w.set_dcdcen(true)); } } + #[cfg(feature = "_nrf54l")] + { + // Turn on DCDC + // From Product specification: + // "Once the device starts, the DC/DC regulator must be enabled using register VREGMAIN.DCDCEN. + // When enabling the DC/DC regulator, the device checks if an inductor is connected to the DCC pin. + // If an inductor is not detected, the device remains in LDO mode" + pac::REGULATORS.vregmain().dcdcen().write(|w| w.set_val(true)); + } // Init GPIOTE #[cfg(not(feature = "_nrf54l"))] // TODO -- cgit