cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-H743ZI RTC/LSE accuracy error

marfourna
Associate II

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

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

View solution in original post

4 REPLIES 4

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

 

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

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

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

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.

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!!!