diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-07-21 00:54:25 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-21 00:54:25 +0200 |
| commit | a7c0985818fba3b20dbd7aff9aa4f49f2399cb05 (patch) | |
| tree | 05c8685bbc6b5aa9ec35a73afd8bd70152d93890 | |
| parent | c1ba1f1f263045cff80a371d65798d545c5243ec (diff) | |
| parent | 8c696a579f763163c8820904ba7e3f4d3eaba2a5 (diff) | |
Merge pull request #4424 from leftger/fix/stm32wba-vddio
embassy-stm32: account for WBA devices and VDDIO2
| -rw-r--r-- | embassy-stm32/src/lib.rs | 13 | ||||
| -rw-r--r-- | embassy-stm32/src/low_power.rs | 6 |
2 files changed, 13 insertions, 6 deletions
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 06c91ef97..700905850 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs | |||
| @@ -242,12 +242,12 @@ pub struct Config { | |||
| 242 | #[cfg(dbgmcu)] | 242 | #[cfg(dbgmcu)] |
| 243 | pub enable_debug_during_sleep: bool, | 243 | pub enable_debug_during_sleep: bool, |
| 244 | 244 | ||
| 245 | /// On low-power boards (eg. `stm32l4`, `stm32l5` and `stm32u5`), | 245 | /// On low-power boards (eg. `stm32l4`, `stm32l5`, `stm32wba` and `stm32u5`), |
| 246 | /// some GPIO pins are powered by an auxiliary, independent power supply (`VDDIO2`), | 246 | /// some GPIO pins are powered by an auxiliary, independent power supply (`VDDIO2`), |
| 247 | /// which needs to be enabled before these pins can be used. | 247 | /// which needs to be enabled before these pins can be used. |
| 248 | /// | 248 | /// |
| 249 | /// May increase power consumption. Defaults to true. | 249 | /// May increase power consumption. Defaults to true. |
| 250 | #[cfg(any(stm32l4, stm32l5, stm32u5))] | 250 | #[cfg(any(stm32l4, stm32l5, stm32u5, stm32wba))] |
| 251 | pub enable_independent_io_supply: bool, | 251 | pub enable_independent_io_supply: bool, |
| 252 | 252 | ||
| 253 | /// On the U5 series all analog peripherals are powered by a separate supply. | 253 | /// On the U5 series all analog peripherals are powered by a separate supply. |
| @@ -291,7 +291,7 @@ impl Default for Config { | |||
| 291 | rcc: Default::default(), | 291 | rcc: Default::default(), |
| 292 | #[cfg(dbgmcu)] | 292 | #[cfg(dbgmcu)] |
| 293 | enable_debug_during_sleep: true, | 293 | enable_debug_during_sleep: true, |
| 294 | #[cfg(any(stm32l4, stm32l5, stm32u5))] | 294 | #[cfg(any(stm32l4, stm32l5, stm32u5, stm32wba))] |
| 295 | enable_independent_io_supply: true, | 295 | enable_independent_io_supply: true, |
| 296 | #[cfg(stm32u5)] | 296 | #[cfg(stm32u5)] |
| 297 | enable_independent_analog_supply: true, | 297 | enable_independent_analog_supply: true, |
| @@ -540,6 +540,13 @@ fn init_hw(config: Config) -> Peripherals { | |||
| 540 | w.set_iosv(config.enable_independent_io_supply); | 540 | w.set_iosv(config.enable_independent_io_supply); |
| 541 | }); | 541 | }); |
| 542 | } | 542 | } |
| 543 | #[cfg(stm32wba)] | ||
| 544 | { | ||
| 545 | use crate::pac::pwr::vals; | ||
| 546 | crate::pac::PWR.svmcr().modify(|w| { | ||
| 547 | w.set_io2sv(vals::Io2sv::B_0X1); | ||
| 548 | }); | ||
| 549 | } | ||
| 543 | #[cfg(stm32u5)] | 550 | #[cfg(stm32u5)] |
| 544 | { | 551 | { |
| 545 | crate::pac::PWR.svmcr().modify(|w| { | 552 | crate::pac::PWR.svmcr().modify(|w| { |
diff --git a/embassy-stm32/src/low_power.rs b/embassy-stm32/src/low_power.rs index 7734365f1..4607eb230 100644 --- a/embassy-stm32/src/low_power.rs +++ b/embassy-stm32/src/low_power.rs | |||
| @@ -124,10 +124,10 @@ pub enum StopMode { | |||
| 124 | Stop2, | 124 | Stop2, |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | #[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0))] | 127 | #[cfg(any(stm32l4, stm32l5, stm32u5, stm32wba, stm32u0))] |
| 128 | use stm32_metapac::pwr::vals::Lpms; | 128 | use stm32_metapac::pwr::vals::Lpms; |
| 129 | 129 | ||
| 130 | #[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0))] | 130 | #[cfg(any(stm32l4, stm32l5, stm32u5, stm32wba, stm32u0))] |
| 131 | impl Into<Lpms> for StopMode { | 131 | impl Into<Lpms> for StopMode { |
| 132 | fn into(self) -> Lpms { | 132 | fn into(self) -> Lpms { |
| 133 | match self { | 133 | match self { |
| @@ -198,7 +198,7 @@ impl Executor { | |||
| 198 | 198 | ||
| 199 | #[allow(unused_variables)] | 199 | #[allow(unused_variables)] |
| 200 | fn configure_stop(&mut self, stop_mode: StopMode) { | 200 | fn configure_stop(&mut self, stop_mode: StopMode) { |
| 201 | #[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0))] | 201 | #[cfg(any(stm32l4, stm32l5, stm32u5, stm32u0, stm32wba))] |
| 202 | crate::pac::PWR.cr1().modify(|m| m.set_lpms(stop_mode.into())); | 202 | crate::pac::PWR.cr1().modify(|m| m.set_lpms(stop_mode.into())); |
| 203 | #[cfg(stm32h5)] | 203 | #[cfg(stm32h5)] |
| 204 | crate::pac::PWR.pmcr().modify(|v| { | 204 | crate::pac::PWR.pmcr().modify(|v| { |
