2022-09-15 06:21 AM
As to save cost we are running the clock of internal RTC in STM32G070RBT6 by our HSE of 8MHz. We have not used an LSE of 32.768KHz.
But due to this, we are observing that our clock is not working properly and after 1 day our current time increase by 5-6 seconds.
We have tuned the clock to the calendar unit by the given formula of ST in application note AN3371. As per this application note, the calendar unit clock must be 1 Hz.
we have tried with values like PREDIV_A to 124 and PREDIV_S to 1999 to give exactly 1 Hz clock to the calendar.
But still, with this, we are getting variation in actual RTC time like on one board RTC time is up by 35 seconds in 6 days, and on another board, it is up by 19 seconds in 4 days.
So can you help us with how we can correct our RTC configuration so that it works correctly or with external crystal HSE of 8MHz this variation expected?
With temperature, variation will be more.
HSE crystal part no. on our board:
TXC CORPORATION
9C08000012
Crystal 8MHZ 9C-8.000MEEJ-T SM
Waiting for help on how to correct this issue...
Initial code we have generated by STM32CubeMx only.
Regards,
Mahendra Rana
2022-09-15 07:03 AM
You should perhaps export the HSE clock via the MCO/PA8 pin an measure the frequency with an accurate frequency counter.
Might want to check the loading on the crystal. If it's way off, perhaps you can tune it better.
If you know the frequency more exactly you can tune the prescaling values.