2020-06-02 08:02 PM
Hello everyone,
I write here to know if someone can help me,
how to be sure the systick value is good ? be sure that 5 seconds are well done ?
thanks to help me !
2020-06-02 09:41 PM
The clock is synchronous measure the clock with a scope, or check the timers against another time base.
2020-06-03 08:42 AM
SysTick uses the HCLK clock, which is derived from the selected high speed oscillator (HSE, HSI, MSI). To test the oscillator frequency you need to either route the HCLK source to an external pin (see MCO in ref manual) to check with a frequency meter, or if you have a high precision LSE oscillator most STM32s have a mode for one of the timers where the timer can trigger on an LSE period. Count the number of HCLKs that occur within the LSE pulse to get the HCLK frequency.
Some HCLK frequencies will not divide evenly to get your timebase. If that's the case you need to account for roundoff error for the SysTick period. Yes, it is a cumulative error and does add up the longer you run. SysTick is not the ideal timer for scheduling over long periods of time. RTC Alarm does a much better job when you get to seconds, minutes etc. assuming you have a precision LSE source.
If you are using the HSI or MSI oscillators for HCLK then SysTick will only be accurate within the oscillator tolerance in the datasheet (i.e. not great for precise times).
Remember the SysTick stops during low power modes (STOP, STANDBY) so you have to account for lost SysTick time if you use those modes.
Jack Peacock
2020-06-04 12:01 PM
thanks for you big answer @JackPeacock, but if i don't have a frenquency meter, there is another method (program in c for example)
@Clive1 how i can with another time base ?
2020-06-04 01:04 PM
GPS 1PPS into a TIMx_CHx Input Capture, using a TIM clocked with the same AHB/SYSTICK clock source.