From 428e75fab75ba03d50dd67bc9baa7daf54d3a275 Mon Sep 17 00:00:00 2001 From: bjoernQ Date: Mon, 27 Feb 2023 13:41:58 +0100 Subject: [PATCH] Disable APM in direct-boot mode --- esp-hal-common/src/lib.rs | 9 +++++++++ esp32c6-hal/src/lib.rs | 2 ++ 2 files changed, 11 insertions(+) diff --git a/esp-hal-common/src/lib.rs b/esp-hal-common/src/lib.rs index 100c994aa1b..763522ea7ec 100644 --- a/esp-hal-common/src/lib.rs +++ b/esp-hal-common/src/lib.rs @@ -130,6 +130,15 @@ pub mod interrupt; #[cfg_attr(esp32s3, path = "peripherals/esp32s3.rs")] pub mod peripherals; +#[cfg(esp32c6)] +pub fn disable_apm_filter() { + unsafe { + (&*esp32c6::LP_APM::PTR).func_ctrl.write(|w| w.bits(0)); + (&*esp32c6::LP_APM0::PTR).func_ctrl.write(|w| w.bits(0)); + (&*esp32c6::HP_APM::PTR).func_ctrl.write(|w| w.bits(0)); + } +} + /// Enumeration of CPU cores /// The actual number of available cores depends on the target. pub enum Cpu { diff --git a/esp32c6-hal/src/lib.rs b/esp32c6-hal/src/lib.rs index 7dcb5fe05c9..4b517a16307 100644 --- a/esp32c6-hal/src/lib.rs +++ b/esp32c6-hal/src/lib.rs @@ -85,6 +85,8 @@ unsafe fn init() { ); r0::init_data(&mut _srtc_fast_text, &mut _ertc_fast_text, &_irtc_fast_text); + + esp_hal_common::disable_apm_filter(); } #[allow(unreachable_code)]