2012-07-30 09:55 PM
I am trying to use systick counter to verify the accuracy of my RTC. Bascially what I did is check the systick counter against RTC timer in the second interrupt. I find it seems the systick count is heavily affected by other interrupts and not accurate. In the end I changed to use DWT cycle count and the result is fairly good and stable. Here my question is how the Systick counter is updated (I'm fairly new to embedded development)? I thought it is not driven by interrupt. The reason I thought like this is if I use TIMX and don't enable its interrupt. The counter of TIMX is pretty accurate.
2012-07-31 04:08 AM
SysTick clocks a 24-bit counter at SYSCLK/HCLK div 8, generates an interrupt at expiration, and restarts. Good for periodic stuff.
Depending on STM32 series, some have RTC LSI/LSE tied to a TIM so period of RTC can be measured explicitly via specific TIMCLK and prescaler. LSI typically not very stable, depending on series some 39-40 KHz, dependent on voltage and temperature. If you want something more stable us a 32 KHz external watch crystal for LSE.2018-02-19 05:25 AM
Hi Clive, i've a similar problem: i want to verify the accuracy of my hardware RTC with an external LSE at 32768Hz (STM32L4) using the Systick.
I create a Timer with an interrupt every 1s. In its Interrupt_Handler i read simultaneously the HAL_Tick and the Timestamp (from the RTC). The result i've obtained is:
- the difference between each interrupt from the Hal_tick was fixed at 1000ms,
- while fot RTC it varied between 980,1020 ms.
Which is correct? The sys_tick or the RTC ?
Thank you
2018-02-19 05:44 AM
'
Which is correct? The sys_tick or the RTC ?'
both are accurate. RTCs don't increment fast -> to conserve energy, as those guys are designed to keep long-term timing accurate.
as the two are asynchronous, and with bigger stepping difference, what you observed can happen.