cancel
Showing results for 
Search instead for 
Did you mean: 

RTC Overflow during Stop Mode

paulsmitton9
Associate III
Posted on April 16, 2009 at 07:31

RTC Overflow during Stop Mode

2 REPLIES 2
paulsmitton9
Associate III
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
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();

}