Skip to main content
mhabermann74
Associate
January 20, 2010
Question

Problems writing RTC_PRL at runtime

  • January 20, 2010
  • 2 replies
  • 716 views
Posted on January 20, 2010 at 02:58

Problems writing RTC_PRL at runtime

    This topic has been closed for replies.

    2 replies

    mhabermann74
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:38

    I found the solution. Writing to the backup and RTC registers must be enabled with:

    PWR_BackupAccessCmd(ENABLE);

    mhabermann74
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:38

    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.