AnsweredAssumed Answered

STM32F103 SysTick Timer Problems

Question asked by alex314 on Sep 18, 2014
Latest reply on Sep 18, 2014 by Clive One

Hello community,

 first of all I’m using the STM32F103RCT6, CooCox IDE 1.7.7 and ARM GCC 4.8.

 Now to my problem. I’m trying to implement a task similar processing by using the Systick timer.

 I initialized the SysTick timer as follows:

 uint32_t returnCode = SysTick_Config(8000);

if (returnCode != 0) {

 //TODO Error handling




The System clock is set to PLL 64MHz. The AHB clock is also set to 64MHz.

I expect that every millisecond an interrupt is being triggered.

t=(8/64MHz)*8000 = 1ms.
Within the interrupt handler a timer value will be increased.

volatile uint32_t timeMS = 0;

void SysTick_Handler(void) {



 Using the following function I’m trying to generate a task every 3 seconds. More accurately the inner function will be called every 3 seconds. The printf() function writes the values of the global and internal timers to the UART interface.

 void task1_handler(uint32_t timer){

       static uint32_t internalTimerCount = 0;

       if (timer >= (internalTimerCount + 3000)) {


             printf("Task1: GlobalTimer %d, IntTimer %d \r\n",timer, internalTimerCount);


             internalTimerCount = timer;



 If i’m using this task_handler the inner function will be called every 6 seconds instead of expected 3 seconds.


I don’t know exactly where the error is or what I did wrong.

 I hope you can help me. This issue is driving me crazy.

Many thanks