cancel
Showing results for 
Search instead for 
Did you mean: 

Slow RTC

Ofaro.1
Associate II

Hi all,

I'm using STM32F429 on a custom board which is running a TFT LCD and RTC is running slow compared to the computer clock. 8MHz crystal is connected to HSE but currently, LSE is using an internal clock. My question is:

Can I connect the external crystal to LSE pins to get accurate RTC or do I need to connect the second crystal to it?

Please see attached pictures.

Any other suggestions will be very helpful, I'm badly stuck here.

1 ACCEPTED SOLUTION

Accepted Solutions

> LSE is using an internal clock.

There is no such thing. According to the picutres, are using LSI, which is an imprecise RC oscillator.

Use the divided HSE as RTC clock. You will need to change the RTC dividers accordingly.

0693W00000UoFxnQAF.png 

JW

View solution in original post

8 REPLIES 8

> LSE is using an internal clock.

There is no such thing. According to the picutres, are using LSI, which is an imprecise RC oscillator.

Use the divided HSE as RTC clock. You will need to change the RTC dividers accordingly.

0693W00000UoFxnQAF.png 

JW

Thanks waclawek for putting me in the right direction.

Just to confirm one thing more, once HSE freq (8MHz) is divided by 8, which gives 1 MHZ. So, in order to run the RTC Do I need to set the Asynchronous and synchronous predivider values from the RTC parameter settings to get 32.768KHz?

Many thanks

> Do I need to set the Asynchronous and synchronous predivider values from the RTC parameter settings to get 32.768KHz?

No. Normally, you set those two values to get 1Hz from 32.768kHz, now you have to change them to get 1Hz from 1MHz.

JW

I have done that and for the first 5 minutes it was exactly according to RTC but then gradually there's a second difference. It showing 27mins 49s while on the stopwatch it's 28mins 0s. I have attached pics for your review.

 
 

Read out and check/post RTC registers content. Note, that prescalers' value in register has to be one less than the value used for calculation:

0693W00000UoQwkQAF.pngso in the register you should see 124 and 7999.

I don't use Cube/CubeMX so I don't know how do the values you put in CubeMX translate to the registers.

JW

Much appreciated your help.

With 125-1 and 8000-1, it works exactly according to RTC.

But I have another custom board with this 8MHz crystal (MC306-G-06Q-32.768) but somehow that one is lagging by 4s. Both crystal's specs are the same. One that works fine is this crystal (7A-8.000MAAJ-T).

Many thanks