cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the system tick reload register "on the fly"

mikesponk2
Associate III

Hi dear friends!

We need to synchronize the tick of the system, that handles some control loops, with an external periodic interrupt, so we tried to slightly adjust the SysTick RELOAD register value, but it seems that as the RELOAD register is changed, the System Tick halts.

We need to do the change on the fly, i.e. without stopping the current counting: we wanted just to change the RELOAD value for the next tick loop.

The maximum change we set in the RELOAD register is small compared to the default value of the RELOAD register, no more than 1 per 1'000.

If we set in the RELOAD the exact same value that has been programmed at tick startup, the tick continues, but as we alter the RELOAD value even by just one unit, the tick halts.

Is it possible to adjust the RELOAD value? Or we have to abandon the system tick and use a standard timer interrupt?

Many thanks for you help

3 REPLIES 3
SBEN .2
Senior II

Hello @mikesponk2​ ,

It is possible to configure the reload value through SYST_RVR, but it isn't advised as it has a well defined purpose (OS tick/system time keeping). In the use-case you've described it would be preferable to use a normal timer instead.

Best regards,

@SBEN .2​ 

mikesponk2
Associate III

Hi, SBEN.2!

Many thanks for your reply!

We already tried changing the reload register, i.e. STK_LOAD aka SYST_RVR, but as stated, when we set a new value in the reload register, the tick stops a nd we do NOT want the tick counter to stop!

Maybe we are missing something?

We are using an STM32F407 chip.

Many thx again!

SBEN .2
Senior II

Hello @mikesponk2​ ,

You need to disable SysTick, change STK_LOAD and then re-enable it again:

0693W00000BctlCQAR.pngOtherwise, I would advise you again to use a normal timer for your application, even for portability sake.

Best regards,

@SBEN .2​