AnsweredAssumed Answered

Systick doesn't fires up as expected

Question asked by benedetto.salvatore on Nov 15, 2011
Latest reply on Nov 16, 2011 by benedetto.salvatore
I programmed the systick timer in order to get 1ms delay but I seem to get a 10us delay instead.

From the reference manual RM0008
"The SysTick calibration value is set to 9000, which gives a reference time base of 1 ms with the SysTick clock set to 9 MHz (max HCLK/8)."

I configured the system clock at 72Mhz and the AHB prescaler at 1. The clock source of the systick is also set to 1, thus clock core. Although I don't understand what it means by "external reference clock". I loaded up 9000 into the systick reload value.

I wrote this simple routine to get a delay

static uint32_t gCounter = 0;

void sys_tick_timer()
{
  if (gCounter)
    gCounter--;
}

static void delayms(uint32_t millisecond)
{
  gCounter = millisecond;
  while (gCounter > 0);
}

but the interrupt seems to be fired much faster then 1ms. I have to load 100*1000 value
to get a delay of about 1 second.

Any suggestions would be appreciated.

S.

Outcomes