|Non-Confidential||PDF version||ARM DUI0471M|
|Home > Handling Processor Exceptions > Configuring SysTick|
To configure SysTick, load the interval required between SysTick events to the SysTick Reload Value register.
The timer interrupt, or COUNTFLAG bit in the SysTick Control and Status register, is
activated on the transition from 1 to 0, therefore it activates every n+1 clock ticks. If you require a period of 100, write 99
to the SysTick Reload Value register. The SysTick Reload Value register supports values
If you want to use SysTick to generate an event at a timed interval, for example 1ms, you can use the SysTick Calibration Value Register to scale your value for the Reload register. The SysTick Calibration Value Register is a read-only register that contains the number of pulses for a period of 10ms, in the TENMS field, bits[23:0].
This register also has a SKEW bit. Bit == 1 indicates that the calibration for 10ms in the TENMS section is not exactly 10ms due to clock frequency. Bit == 1 indicates that the reference clock is not provided.
For Cortex-M1 processors, the TENMS field reads as zero because the calibration value is unknown.
The Control and Status Register can poll the timer either by reading COUNTFLAG, bit and the SysTick generating an interrupt.
By default, SysTick is configured for polling mode. In this mode, user code polls COUNTFLAG, to ascertain if the SysTick event had occurred. This is indicated by COUNTFLAG being set. Reading the Control and Status register clears COUNTFLAG. To configure SysTick to generate an interrupt, set TICKINT, bit of the SysTick Control and Status register, to 1. You must also enable the appropriate interrupt in the NVIC, and select the clock source using CLKSOURCE, bit. Setting this to 1 selects the processor clock, and 0 selects the external reference clock.
For ARMv6-M processors, the CLKSOURCE bit is set because SysTick always uses the processor clock.
You can enable the timer by setting bit of the SysTick Status and Control register.