stm32/powerctrl: Disable RTC write protection before changing flags.

pull/6669/head
iabdalkader 2020-12-02 23:35:58 +02:00 zatwierdzone przez Damien George
rodzic 463a275bc4
commit 8add94e94e
1 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -689,6 +689,10 @@ void powerctrl_enter_standby_mode(void) {
// save RTC interrupts
uint32_t save_irq_bits = RTC->CR & CR_BITS;
// disable register write protection
RTC->WPR = 0xca;
RTC->WPR = 0x53;
// disable RTC interrupts
RTC->CR &= ~CR_BITS;
@ -714,6 +718,9 @@ void powerctrl_enter_standby_mode(void) {
// enable previously-enabled RTC interrupts
RTC->CR |= save_irq_bits;
// enable register write protection
RTC->WPR = 0xff;
#if defined(STM32F7)
// Enable the internal (eg RTC) wakeup sources
// See Errata 2.2.2 "Wakeup from Standby mode when the back-up SRAM regulator is enabled"