cancel
Showing results for 
Search instead for 
Did you mean: 

Clock problem of SysTick Timer for 1 sn

akin
Associate
Posted on January 18, 2010 at 19:23

Clock problem of SysTick Timer for 1 sn

2 REPLIES 2
akin
Associate
Posted on May 17, 2011 at 13:03

There is an example on the address ''C:\Keil\ARM\Examples\ST\STM32F10x\NVIC\Example3'' .This application uses SysTick Timer to make an interrupt every 1 sn.There is no clock source adjustment for SysTick timer,so default clock source is used(HCLK/8 --> 72 Mz / 8= 9 Mhz)Set up code lines for SysTick timer is shown on the below.

/* SysTick interrupt each 1 Hz with Counter clock equal to 72MHz/8 = 9MHz */

SysTick_SetReload(9000000);

I tried this application on MCBSTM32 kit.I made toggle a led connected to PortB (PB8) instead of PortC.But the delay between led's toggle positions was more than 1 sn.(nearly 8 sn )I added the code ''SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);.Delay become just 1 sn this time.But it's value should have be 1/10 sn .

What is the wrong with this application?

Best Regards;

steven2
Associate
Posted on May 17, 2011 at 13:03

I am also having this problem. My clock tree is as follows:

OSC_IN(8MHz)

|

(x9)PLLMUL

|

SYSCLK

|

(/1)AHB Prescaler

Therefore my Cortex System Timer will be running at 9MHz. When the SysTick registers are setup in the following manner, I do not get a 1ms interrupt.

__INLINE static void init_SysTick(void)

{

SysTick->LOAD = 0x0089543F; //8999999dec

SysTick->CTRL = 0x00000007;

}

The interrupt is firing, but its much slower than 1ms.

Have I overlooked something?