276. RTC_WPR protection is not locked by system reset
In RTC (except RTCv1 in 'F1), most RTC registers are protected against spurious writes by two mechanisms:
- PWR_CR.DBP, which protects against write to the backup-domain in general,
- RTC_WPR, which requires writing two particular values into this register to unlock writing to many other RTC registers
While the PWR_CR.DBP protection is re-locked upon every system reset, the RTC_WPR lock is not. Besides software acton - writing incorrect value into RTC_WPR - the RTC_WPR protection is re-locked only upon backup-domain reset, i.e. when power is removed from VBAT, or the RCC_BDCR.BDRST bit is set.
While this is documented in the RTC register write protection subchapter of RTC chapter of RM, this may be a surprising fact to many users, and underpins the importance of maintaining discipline with locking/unlocking the RTC write in software upon every access.