cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f091 rtc error

Hi. As you can see in the picture I haven't got the LSE crystal resonator so I have 40 Khz as RTC input. The datetime is not well calculated.

How can I resolve the problem? Is there a way to have an affidable rtc whitout the resonator?

0690X000006CxyrQAC.png

2 REPLIES 2

>>The datetime is not well calculated.

Not sure how to interpret that, too fast, too slow?

Measure the frequency, and use that for the prescaler/divider values. On the F1's this was closer to 37 KHz.

You should be able to measure RTC clock performance vs HSE using a TIM.

TIM14 per RM

STM32Cube_FW_F0_V1.9.0\Projects\STM32072B_EVAL\Examples\IWDG\IWDG_Reset\Src\main.c

See GetLSIFrequency(), and fix the math ordering

  /* Frequency computation POOR MATH */

  uwLsiFreq = (uint32_t) SystemCoreClock / lsiperiod;

  uwLsiFreq *= 8;

  /* Frequency computation BETTER */

  uwLsiFreq = ((uint32_t) SystemCoreClock * 8)/ lsiperiod;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Too fast. The ideal value shoult be 32,768.

Is there a way to use the rtc without a crystal resonator or have I to use another way to get a timestamp / date time value?