cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 RTC Time lags

Manjunatha S
Associate II
Posted on November 24, 2014 at 15:13

Hi,

I'm using STM32l151rbt6 MCU. But after few days of running the program the internal RTC starts lagging. I'm not doing RTC calibration. Any other possible reasons?

Thanks.

#stm32 #rtc
16 REPLIES 16
Posted on November 24, 2014 at 15:27

Exactly how much?

What is your crystal (brand, product number) and the loading capacitors?

JW

Manjunatha S
Associate II
Posted on December 05, 2014 at 11:38

Hi,

Thanks for the reply. I never noticed the lag in the room temperature. And i don't know the exact amount of lag, When i installed my logger in the Site where the temperature varies 16 - 40C. When i see the logger after 6 months some of them lags one day and some of them lags 1 month. The component details are as follows. Please suggest me if calibration of crystal frequency is needed or any other possible solution.

Component value         Make               Part NO.

 crystal         32.768KHz         citizen finetech miyota              CM130-32.768KDZF-UT

 Capacitor    18pF 250V Murata electronics           GRM21A5C2E180JW01D 

     

5% NPO

     

John F.
Senior
Posted on December 05, 2014 at 12:01

The crystal has a load capacitance of 12.5pF so assuming you have 18pf on both ends and allowing for parasitic capacitance that looks about right. The frequency is designed for 25C and will change at higher and lower temperatures (temperature coefficient) but not by as much as you're seeing!

Either your oscillator is sometimes stopping then restarting or it's sometimes running very slow. I expect power supply or PCB problems to be the cause. Are your PCBs washed? Contamination often sits under surface mount packages. Alternatively are they conformally coated? Do you have condensation on the PCBs sometimes?

Manjunatha S
Associate II
Posted on December 05, 2014 at 12:41

Hi,

There is no contamination on PCBs as i noticed, and PCBs are not conformally coated. Is there any other accurate way of testing the stability of RTC?

Manjunatha S
Associate II
Posted on December 05, 2014 at 12:46

Also I'm using standby mode(when main power fails the it will be switched to 3V backup power) and stop mode when there is no tasks to do.

Posted on December 05, 2014 at 13:06

Are you sure you run the RTC from LSE and not from LSI? What is the content of RCC_CSR?

JW

Posted on December 05, 2014 at 14:48

Several of the STM32 family allow you to measure the LSI/LSE against a timer, which can be clocked by an accurate HSE (crystal or source). You should also be able to push several internal clocks out via the MCO (PA8) pin. Pretty sure the L1 series gives you access to LSI and LSE

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Manjunatha S
Associate II
Posted on December 10, 2014 at 13:43

RTC is running from LSE and the RCC_CSR content is 0x14410300

Manjunatha S
Associate II
Posted on December 10, 2014 at 14:33

Hi Clive,

I measured LSE via MCO pin. It was 32.75 to 32.89KHz. I think it's fine. What do you say?