aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2025-11-05 07:13:15 -0600
committerxoviat <[email protected]>2025-11-05 07:13:15 -0600
commit2f26c3c5f1380535c5fdd74cd39962338ed51204 (patch)
tree8f5e137e832b00f4cca0e80634747ccd4121a7f5
parentff42c61dc6c0f870b4022aca52f3c45d992ae735 (diff)
tests: disable rtc for h563 on non-stop
-rw-r--r--embassy-stm32/Cargo.toml1
-rw-r--r--embassy-stm32/src/rtc/mod.rs15
-rw-r--r--tests/stm32/Cargo.toml2
-rw-r--r--tests/stm32/src/bin/rtc.rs4
-rw-r--r--tests/stm32/src/bin/stop.rs1
-rw-r--r--tests/stm32/src/common.rs2
6 files changed, 23 insertions, 2 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index 7c243b350..7c64c3e17 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -313,6 +313,7 @@ single-bank = []
313 313
314## internal use only 314## internal use only
315_split-pins-enabled = [] 315_split-pins-enabled = []
316_allow-disable-rtc = []
316 317
317## internal use only 318## internal use only
318_dual-core = [] 319_dual-core = []
diff --git a/embassy-stm32/src/rtc/mod.rs b/embassy-stm32/src/rtc/mod.rs
index cbb904fd3..116b3c7ed 100644
--- a/embassy-stm32/src/rtc/mod.rs
+++ b/embassy-stm32/src/rtc/mod.rs
@@ -175,13 +175,21 @@ pub struct RtcConfig {
175 /// 175 ///
176 /// A high counter frequency may impact stop power consumption 176 /// A high counter frequency may impact stop power consumption
177 pub frequency: Hertz, 177 pub frequency: Hertz,
178
179 #[cfg(feature = "_allow-disable-rtc")]
180 /// Allow disabling the rtc, even when stop is configured
181 pub _disable_rtc: bool,
178} 182}
179 183
180impl Default for RtcConfig { 184impl Default for RtcConfig {
181 /// LSI with prescalers assuming 32.768 kHz. 185 /// LSI with prescalers assuming 32.768 kHz.
182 /// Raw sub-seconds in 1/256. 186 /// Raw sub-seconds in 1/256.
183 fn default() -> Self { 187 fn default() -> Self {
184 RtcConfig { frequency: Hertz(256) } 188 RtcConfig {
189 frequency: Hertz(256),
190 #[cfg(feature = "_allow-disable-rtc")]
191 _disable_rtc: false,
192 }
185 } 193 }
186} 194}
187 195
@@ -372,6 +380,11 @@ trait SealedInstance {
372 380
373#[cfg(feature = "low-power")] 381#[cfg(feature = "low-power")]
374pub(crate) fn init_rtc(cs: CriticalSection, config: RtcConfig) { 382pub(crate) fn init_rtc(cs: CriticalSection, config: RtcConfig) {
383 #[cfg(feature = "_allow-disable-rtc")]
384 if config._disable_rtc {
385 return;
386 }
387
375 crate::time_driver::get_driver().set_rtc(cs, Rtc::new_inner(config)); 388 crate::time_driver::get_driver().set_rtc(cs, Rtc::new_inner(config));
376 389
377 trace!("low power: stop with rtc configured"); 390 trace!("low power: stop with rtc configured");
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml
index e75a4ebb1..b92b47be2 100644
--- a/tests/stm32/Cargo.toml
+++ b/tests/stm32/Cargo.toml
@@ -73,7 +73,7 @@ teleprobe-meta = "1"
73embassy-sync = { version = "0.7.2", path = "../../embassy-sync", features = ["defmt"] } 73embassy-sync = { version = "0.7.2", path = "../../embassy-sync", features = ["defmt"] }
74embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } 74embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] }
75embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "tick-hz-131_072", "defmt-timestamp-uptime"] } 75embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "tick-hz-131_072", "defmt-timestamp-uptime"] }
76embassy-stm32 = { version = "0.4.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "memory-x", "time-driver-any"] } 76embassy-stm32 = { version = "0.4.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "memory-x", "time-driver-any", "_allow-disable-rtc"] }
77embassy-futures = { version = "0.1.2", path = "../../embassy-futures" } 77embassy-futures = { version = "0.1.2", path = "../../embassy-futures" }
78embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg", "ble"] } 78embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg", "ble"] }
79embassy-net = { version = "0.7.1", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] } 79embassy-net = { version = "0.7.1", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] }
diff --git a/tests/stm32/src/bin/rtc.rs b/tests/stm32/src/bin/rtc.rs
index 43cf4a411..eb27af4ca 100644
--- a/tests/stm32/src/bin/rtc.rs
+++ b/tests/stm32/src/bin/rtc.rs
@@ -19,6 +19,10 @@ use embassy_time::Timer;
19async fn main(_spawner: Spawner) { 19async fn main(_spawner: Spawner) {
20 let mut config = config(); 20 let mut config = config();
21 config.rcc.ls = LsConfig::default_lse(); 21 config.rcc.ls = LsConfig::default_lse();
22 #[cfg(feature = "stop")]
23 {
24 config.rtc._disable_rtc = false;
25 }
22 26
23 let p = init_with_config(config); 27 let p = init_with_config(config);
24 info!("Hello World!"); 28 info!("Hello World!");
diff --git a/tests/stm32/src/bin/stop.rs b/tests/stm32/src/bin/stop.rs
index 4b3a775bb..1fe65d867 100644
--- a/tests/stm32/src/bin/stop.rs
+++ b/tests/stm32/src/bin/stop.rs
@@ -49,6 +49,7 @@ async fn async_main(spawner: Spawner) {
49 49
50 let mut config = Config::default(); 50 let mut config = Config::default();
51 config.rcc.ls = LsConfig::default_lse(); 51 config.rcc.ls = LsConfig::default_lse();
52 config.rtc._disable_rtc = false;
52 53
53 // System Clock seems cannot be greater than 16 MHz 54 // System Clock seems cannot be greater than 16 MHz
54 #[cfg(any(feature = "stm32h563zi", feature = "stm32h503rb"))] 55 #[cfg(any(feature = "stm32h563zi", feature = "stm32h503rb"))]
diff --git a/tests/stm32/src/common.rs b/tests/stm32/src/common.rs
index 2bd934d6f..096cce947 100644
--- a/tests/stm32/src/common.rs
+++ b/tests/stm32/src/common.rs
@@ -468,6 +468,8 @@ pub fn config() -> Config {
468 config.rcc.apb3_pre = APBPrescaler::DIV1; 468 config.rcc.apb3_pre = APBPrescaler::DIV1;
469 config.rcc.sys = Sysclk::PLL1_P; 469 config.rcc.sys = Sysclk::PLL1_P;
470 config.rcc.voltage_scale = VoltageScale::Scale0; 470 config.rcc.voltage_scale = VoltageScale::Scale0;
471
472 config.rtc._disable_rtc = true;
471 } 473 }
472 474
473 #[cfg(feature = "stm32h503rb")] 475 #[cfg(feature = "stm32h503rb")]