stm32/powerctrl: Disable RTC write protection before changing flags.
This commit is contained in:
parent
463a275bc4
commit
8add94e94e
@ -689,6 +689,10 @@ void powerctrl_enter_standby_mode(void) {
|
|||||||
// save RTC interrupts
|
// save RTC interrupts
|
||||||
uint32_t save_irq_bits = RTC->CR & CR_BITS;
|
uint32_t save_irq_bits = RTC->CR & CR_BITS;
|
||||||
|
|
||||||
|
// disable register write protection
|
||||||
|
RTC->WPR = 0xca;
|
||||||
|
RTC->WPR = 0x53;
|
||||||
|
|
||||||
// disable RTC interrupts
|
// disable RTC interrupts
|
||||||
RTC->CR &= ~CR_BITS;
|
RTC->CR &= ~CR_BITS;
|
||||||
|
|
||||||
@ -714,6 +718,9 @@ void powerctrl_enter_standby_mode(void) {
|
|||||||
// enable previously-enabled RTC interrupts
|
// enable previously-enabled RTC interrupts
|
||||||
RTC->CR |= save_irq_bits;
|
RTC->CR |= save_irq_bits;
|
||||||
|
|
||||||
|
// enable register write protection
|
||||||
|
RTC->WPR = 0xff;
|
||||||
|
|
||||||
#if defined(STM32F7)
|
#if defined(STM32F7)
|
||||||
// Enable the internal (eg RTC) wakeup sources
|
// Enable the internal (eg RTC) wakeup sources
|
||||||
// See Errata 2.2.2 "Wakeup from Standby mode when the back-up SRAM regulator is enabled"
|
// See Errata 2.2.2 "Wakeup from Standby mode when the back-up SRAM regulator is enabled"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user