cancel
Showing results for 
Search instead for 
Did you mean: 

RTC smooth calibration on STMF446

snowmonster
Associate II

Hi.

I am trying to implement RTC smooth calibration on STM32F446 MCU based board.  Did look at the example "Real Time Clock (RTC) software expansion for STM32Cube (AN4759)" where smooth calibration is implemented using two timers. The first one counts up to 32 1Hz input pulses and the second one counts number of LSE ticks during that time. Counts are then used to speed up or slow down RTC.

Example uses STM32L476RG Nucleo board which has TIM2 TIM2_ETR connected to LSE. Which means that TI1FP2 can be used as TRGI as up count (CK_PSC) to be able to count LSE ticks.

But STM32F446 does not have such timer. Its TIM5 can have LSE as input on channel 4, but it can not be used as an input to TRGI. Only channel 1 and 2 can be inputs to TRGI mux.

Does anyone know a solution/idea for this?

Should/could it be done in a different way?

Another way would probably be to use a reference clock (50-60Hz), but I only have 1Hz. Would that work maybe?

Thank you very much for any comment.

2 REPLIES 2
snowmonster
Associate II

LSE is used as RTC clock source.

It is intended to be used as input capture, calibrating against HSE used as primary source clock for system thus timer. HSE then can be in turn calibrated to an external source using a different channel or different timer, assuming HSE being fairly stable.

But you can also calibrate directly against the 1Hz input, using it as the external clock, counting input capture interrupts until the required time elapsed - 32kHz ISRs should be viable, especially since calibration is presumably a one-off operation and other interrrupts can be switched off during that time.

JW