cancel
Showing results for 
Search instead for 
Did you mean: 

how to use external clock source for RTC?

Vinay1
Associate II

please find the attachment of clock configuration snapshot.

i'm trying to use external clock source for RTC application. [i.e, HSE or LSE]

But the RTC too faster than the normal time.

is it requires any other configuration? or

how to fix this issue?

1 ACCEPTED SOLUTION

Accepted Solutions

The values for the capacitors C16 and C27 depend on the 32.768kHz crystal, soldered on X3. Details how to calculate them can be found in AN2867, section 3.3, with the relevant values in table 5. Typical values could be in the range of 5...15pF.

BTW: a crystal is a passive device, while a crystal oscillator is an active one, also containing the oscillator electronics incl. capacitors etc beside the crystal.

R27 doesn't necessarily need to be changed, because it affects pin PDR_ON. Don't be confused by the marking on the board - R27 is very close to C27.

But you need to put a solder bridge or 0-ohms resistors to R21/R22 if not already fitted.

Good luck!

If the problem is resolved, please mark this topic as answered by selecting Select as best. This will help other users find that answer faster.

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

6 REPLIES 6
Peter BENSCH
ST Employee

With the setup on your screenshot you are using 32.768kHz, which comes from the LSE, but the LSE in BYPASS Clock Source, because you have only connected one input. If the typical crystal is connected there, the LSE must be set to Crystal/Ceramic Resonator in the RCC block in the configuration.

The two prescalers in the RTC block are also important, the product of which (each increased by one because zero also counts) must be 2^15 = 32768, e.g. 127 and 255.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

> But the RTC too faster than the normal time.

How do you know? How exactly do you check that?

What's your hardware? Which STM32? Is this a "known good" board or your design? What is the LSE and VCC/VBAT pins connection? Does the problem happen while VDD is up, or only when running from VBAT?

Read out and check/post RCC_BDCR and RTC registers content.

JW

> How do you know? How exactly do you check that?

i am comparing RTC time with my cell phone time.

i am using stm32f407vg discovery board. it was powered through USB

thank you for your response.

i am using stm32f407vg discovery board. in that the crystal oscillator [X3] was not mounted.

i'm purchased the 32.768 kHz crystal oscillator and i plan to solder that on stm32f407vg discovery board. but i did not get to know the values of register and capacitor.

may i know what values of register and capacitor need to use in place of C16, C27 and R27 ?

The values for the capacitors C16 and C27 depend on the 32.768kHz crystal, soldered on X3. Details how to calculate them can be found in AN2867, section 3.3, with the relevant values in table 5. Typical values could be in the range of 5...15pF.

BTW: a crystal is a passive device, while a crystal oscillator is an active one, also containing the oscillator electronics incl. capacitors etc beside the crystal.

R27 doesn't necessarily need to be changed, because it affects pin PDR_ON. Don't be confused by the marking on the board - R27 is very close to C27.

But you need to put a solder bridge or 0-ohms resistors to R21/R22 if not already fitted.

Good luck!

If the problem is resolved, please mark this topic as answered by selecting Select as best. This will help other users find that answer faster.

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

thank you