cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L100 RTC

EChum
Associate

Hello!

In my design, I want to use the STM32L100 series microcontroller. How can I get a clock frequency RTC of 1 Hz if I use a highly stable external oscillator with a frequency of 30 MHz to clock the microcontroller.

PREDIV_A can be 1,2,3, ..., or 127

PREDIV_S can be 0,1,2, ..., or 8191

HSE_RTC = 30 MHz / 16

ck_spre = RTCCLK / ((PREDIV_A + 1) * (PREDIV_S + 1))

ck_spre = 1875000 / ((127 + 1) * (8191 + 1)) = 255 Hz

How do I get a RTC 1Hz frequency?

2 REPLIES 2

According to the datasheet the max. allowed frequency for the HSE is 24MHz. Anything higher than that is likely to fail.

Also, the max. output of HSEDiv for clocking the RTC should not exceed 1MHz, 30 / 16 is 1.875MHz which is way higher than the max.

You have two options, use a 32768Hz LSE or use a 16MHz HSE so that 16MHz / 16 is 1MHz (max. allowed).

 [Click Show More]

ck_spre = RTCCLK / ((PREDIV_A + 1) * (PREDIV_S + 1))

ck_spre = 1000000 / ((124 + 1) * (7999 + 1)) = 1

EChum
Associate

In the description on STM32L100 it is written that the maximum clock frequency of the HSE can be 32 MHz.