Merge pull request #2616 from embassy-rs/h5-stupid-errata

stm32/rcc: workaround nonsense RAM suicide errata on backup domain reset.
This commit is contained in:
Dario Nieuwenhuis 2024-02-23 00:25:30 +01:00 committed by GitHub
commit 4481c5f3cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -201,11 +201,18 @@ impl LsConfig {
bdcr().modify(|w| w.set_bdrst(true)); bdcr().modify(|w| w.set_bdrst(true));
bdcr().modify(|w| w.set_bdrst(false)); bdcr().modify(|w| w.set_bdrst(false));
} }
#[cfg(any(stm32h5))] // H5 has a terrible, terrible errata: 'SRAM2 is erased when the backup domain is reset'
{ // pending a more sane sane way to handle this, just don't reset BD for now.
bdcr().modify(|w| w.set_vswrst(true)); // This means the RTCSEL write below will have no effect, only if it has already been written
bdcr().modify(|w| w.set_vswrst(false)); // after last power-on. Since it's uncommon to dynamically change RTCSEL, this is better than
} // letting half our RAM go magically *poof*.
// STM32H503CB/EB/KB/RB device errata - 2.2.8 SRAM2 unduly erased upon a backup domain reset
// STM32H562xx/563xx/573xx device errata - 2.2.14 SRAM2 is erased when the backup domain is reset
//#[cfg(any(stm32h5))]
//{
// bdcr().modify(|w| w.set_vswrst(true));
// bdcr().modify(|w| w.set_vswrst(false));
//}
#[cfg(any(stm32c0))] #[cfg(any(stm32c0))]
{ {
bdcr().modify(|w| w.set_rtcrst(true)); bdcr().modify(|w| w.set_rtcrst(true));