Skip to main content
Graduate
February 21, 2024
Solved

NUCLEO-H743ZI RTC/LSE accuracy error

  • February 21, 2024
  • 2 replies
  • 1969 views

I'm trying to implement a RTC using the LSE crystal of Nucleo-h743zi board (Rev.B model). In addition, I want to backup the timestamp in case of power loss. Following the reference and user manuals, I finally have my RTC worked, using RTC backup registers and a external battery connected to VBAT (unsoldered SB156 and enabled mcu internal charger). So far so good. Unfortunately, after a couple of minutes I realize that RTC loses about 1 or 2 minute. This fault is getting bigger and after 24 hours this fault is about 1hour.

I use the RTC as an internal clock and I don't use tamper or wakeup pins. I have also read the errata sheet and I think there is no any conflict or interference with other pins or functions. If I choose to work with the LSI crystal, the aforementioned problem is not occurs. But in that case the backup function doesn't work. It is worth mentioning that the RTC has the same behavior even if I run any of the STM32cube examples pertaining to rtc.

Furthermore, I tried to measure the calibration output (512Hz) of RTC using my oscillator in order to calculate the error in ppm. But the error I took was by far less than the error mentioned above.

I have started to believe that 32.768kHz crystal is not working properly. Any ideas?

I provide you below my initialize functions of the RTC.

 

marfourna_0-1708557983700.png

marfourna_1-1708558082114.png

Thank you in advance.

 

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    Currently you've got it set to 63488 KHz, so probably time is running about 1/2 as fast as normal

    2 replies

    Graduate II
    February 21, 2024

    Your prediv values look wrong, fix them

    #define RTC_CLOCK_SOURCE_LSE
    
    #ifdef RTC_CLOCK_SOURCE_LSI // 32000
    #define RTC_ASYNCH_PREDIV 0x7F
    #define RTC_SYNCH_PREDIV 0xF9
    #endif
    
    #ifdef RTC_CLOCK_SOURCE_LSE // 32768
    #define RTC_ASYNCH_PREDIV 0x7F
    #define RTC_SYNCH_PREDIV 0x00FF
    #endif

     

    Graduate II
    February 21, 2024

    Currently you've got it set to 63488 KHz, so probably time is running about 1/2 as fast as normal

    marfournaAuthor
    Graduate
    February 22, 2024

    How I didn't see it? Yeah that was the problem. I have just fixed it and it seems that its working. Thanks a lot!!!

    ST Employee
    February 22, 2024

    I have started to believe that 32.768kHz crystal is not working properly

    You may output 32768Hz LSE at MCO - usually PA8 pin and check its frequency with scope or frequency meter.