Hi Kaouthar,
> The BackUp Registers are part of the RTC peripheral so we will need to enable the RTC to be able to access them.
I don't know what do you exactly mean by "enable the RTC" in terms of peripheral registers' content, but generally I disagree. Here's my take, please correct me if I am wrong:
- RTC backup registers (RTC_BKPxR) in 'F401 are readable immediately after reset.
- to be able write RTC_BKPxR, you need to set PWR_CR.DBP, nothing else.
- RTC_BKPxR content is preserved during VDD down, if valid voltage is present on VBAT pin all the time. There's no need to enable anything in the peripheral registers for this.
This all can be very easily checked, no program needed, just using the debugger. I don't have an 'F401 at hand and tested on 'F407, but I see nothing in the RM to indicate different behaviour.
Enabling RTC clock by setting nonzero RCC_BDCR.RTCSEL and setting RCC_BDCR.RTCEN indeed increases current consumption on VBAT pin, and is not needed for using RTC_BKPxR alone.
In some STM32, there is an extra bit, RCC_APBxENR.RTCAPBEN, which enables/disables APB clock for RTC. In 'F401, there is no such bit so it's of no concern here.
JW
@KDJEM.1