Skip to main content
paulsmitton9
Associate III
April 16, 2009
Question

RTC Overflow during Stop Mode

  • April 16, 2009
  • 2 replies
  • 655 views
Posted on April 16, 2009 at 07:31

RTC Overflow during Stop Mode

    This topic has been closed for replies.

    2 replies

    paulsmitton9
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:09

    I seem to be having a problem with the following sequence:

    Setup RTC

    Enter Stop Mode

    (RTC Overflows)

    Leave Stop Mode

    Call RTC_WaitForSynchro

    Read RTC_FLAG_OWF

    When I read the overflow flag (RTC_FLAG_OWF) it is cleared, rather than set.

    The manual does say (RTC: 8.4.2 note 3) that ''The OWF, ALRF, SECF and RSF bits are not updated when the APB1 clock is not running.''

    However, shouldn't they be updated with the overflow flag set when RTC_WaitForSynchro is called?

    The flag is setting if the RTC rolls over whilst not in stop mode.

    paulsmitton9
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:09

    I think may be either a problem with my understanding of the manual, or the silicon.

    Meanwhile I'm working-around with:

    Code:

    void CheckRtcOverflow(void)

    {

    if

    (

    (RTC->CRL & RTC_FLAG_OW) ||

    (GetRtcCounter() < Rtc.LastCheckTime)

    )

    {

    Rtc.OverflowCounter++;

    RTC->CRL &= ~RTC_FLAG_OW;

    }

    Rtc.LastCheckTime = GetRtcCounter();

    }