2010-01-19 05:58 PM
Problems writing RTC_PRL at runtime
2011-05-17 04:38 AM
I intend to calibrate the RTC by adjusting the prescaler in the RTC_PLR register. But any write to this register while enabled RTC, causes the RTOFF bit to hang.
This code hangs: RTC_WaitForSynchro(); RTC_WaitForLastTask(); RTC_SetPrescaler(ReoTime_maxRtcPrl); RTC_WaitForLastTask(); //hangs forever This code also: RTC_WaitForLastTask(); RTC_EnterConfigMode(); RTC->PRLL = (u16)ReoTime_maxRtcPrl; RTC_ExitConfigMode(); RTC_WaitForLastTask(); //hangs forever Without writing to RTC_PRL, i.e. using the configuration created with STM32_Init.c unmodified, the RTC works as expected.2011-05-17 04:38 AM
I found the solution. Writing to the backup and RTC registers must be enabled with:
PWR_BackupAccessCmd(ENABLE);