cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with RTC

fbenito
Associate
Posted on August 03, 2012 at 10:43

Hi gents,

We're using a STM32F217IGH6, in a Silica Xynergy board, and we're experiencing some strange issues with the RTC. The code regarding RTC is:

static
void
rtcConfiguration(
void
)
{
// Reset power domain : The only possible way of modifying the RTC clock source !!!
PWR_DeInit();
/* Enable PWR clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); 
/* Allow access to RTC */
PWR_BackupAccessCmd(ENABLE);
/* Enable LSE clock */
RCC_LSEConfig(RCC_LSE_ON);
/* Wait till LSE is ready */
while
(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET);
/* Select LSE as RTC Clock Source */
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); 
/* Enable RTC Clock */
RCC_RTCCLKCmd(ENABLE);
/* Wait for RTC registers synchronization */
RTC_WaitForSynchro();
}

But the RTC doesn't behave as it should... sometimes it just doesn't tick, or it starts ticking, and after a few seconds, it stops. We are working with an external 768kHz quartz, but changing to internal oscillator does not seem to solve the problem. Do you have any suggestion of what may be happening here? Thanks a lot!! #stm32-rtc
2 REPLIES 2
ColdWeather
Senior
Posted on August 03, 2012 at 12:44

Hello!

1. It's know issue, the STM's are sensible to the external 32kHz quartz parameters and load capacitors at its terminals. 2. I found in my code of the RTC initialization a call to

RTC_WaitForLastTask()

after PWR_BackupAccessCmd() commented by myself as ''important!''

(but I forgot, why :)).
fbenito
Associate
Posted on August 06, 2012 at 08:44

Hi,

Thanks for the answer!! Actually, I had been playing with the crystal capacitors, and noticed I could force a tick of the RTC if I put my finger in the right spot near the capacitors, so I suspected this kind of problem.

Finally, I solved the problem by removing a 1Mohm resistor parallel to the crystal (it wasn't there in the datasheet proposed circuit, so I tried removing it).