configure
When writing the RTC_PRL, RTC_CNT, RTC_ALR registers, you need to enter the configuration mode first, by setting the CNF bit of the RTC_CRL register to one.
In addition, each time you configure a register, you must wait for the previous configuration to complete. You can check whether the RTOFF bit in RTC_CRL is 1, and you need to wait until it is 1 before you can perform the next configuration.
Configuration steps:
- Loop through RTOFF until it is 1.
- Set CNF to enter configuration mode.
- Configure the registers that need to be configured.
- Clear the CNF bit to exit configuration mode.
- Loop through RTOFF until it is 1 to determine successful configuration.