diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-02-23 00:25:30 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-02-23 00:25:30 +0100 |
| commit | 4481c5f3ccf29da071538ef4f1e48fc5372a72a5 (patch) | |
| tree | a67f077dac548fec606c635da0685260acd818ef | |
| parent | 9c918f6474cedfa7d6a2d36c416c3c380ee0c747 (diff) | |
| parent | 475dea0208954453f935ddb8713fcf9155d3bd22 (diff) | |
Merge pull request #2616 from embassy-rs/h5-stupid-errata
stm32/rcc: workaround nonsense RAM suicide errata on backup domain reset.
| -rw-r--r-- | embassy-stm32/src/rcc/bd.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/embassy-stm32/src/rcc/bd.rs b/embassy-stm32/src/rcc/bd.rs index d20f58185..cb10a9a3f 100644 --- a/embassy-stm32/src/rcc/bd.rs +++ b/embassy-stm32/src/rcc/bd.rs | |||
| @@ -201,11 +201,18 @@ impl LsConfig { | |||
| 201 | bdcr().modify(|w| w.set_bdrst(true)); | 201 | bdcr().modify(|w| w.set_bdrst(true)); |
| 202 | bdcr().modify(|w| w.set_bdrst(false)); | 202 | bdcr().modify(|w| w.set_bdrst(false)); |
| 203 | } | 203 | } |
| 204 | #[cfg(any(stm32h5))] | 204 | // H5 has a terrible, terrible errata: 'SRAM2 is erased when the backup domain is reset' |
| 205 | { | 205 | // pending a more sane sane way to handle this, just don't reset BD for now. |
| 206 | bdcr().modify(|w| w.set_vswrst(true)); | 206 | // This means the RTCSEL write below will have no effect, only if it has already been written |
| 207 | bdcr().modify(|w| w.set_vswrst(false)); | 207 | // after last power-on. Since it's uncommon to dynamically change RTCSEL, this is better than |
| 208 | } | 208 | // letting half our RAM go magically *poof*. |
| 209 | // STM32H503CB/EB/KB/RB device errata - 2.2.8 SRAM2 unduly erased upon a backup domain reset | ||
| 210 | // STM32H562xx/563xx/573xx device errata - 2.2.14 SRAM2 is erased when the backup domain is reset | ||
| 211 | //#[cfg(any(stm32h5))] | ||
| 212 | //{ | ||
| 213 | // bdcr().modify(|w| w.set_vswrst(true)); | ||
| 214 | // bdcr().modify(|w| w.set_vswrst(false)); | ||
| 215 | //} | ||
| 209 | #[cfg(any(stm32c0))] | 216 | #[cfg(any(stm32c0))] |
| 210 | { | 217 | { |
| 211 | bdcr().modify(|w| w.set_rtcrst(true)); | 218 | bdcr().modify(|w| w.set_rtcrst(true)); |
