2010-11-11 01:36 PM
Hi, I can get SysTick working, but the maths for timing elude me.
I have SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8); if (SysTick_Config(SystemCoreClock / 20000)) { /* Capture error */ while(1); } System is running at 24MHz and SysTick at 3MHz (/8). I just toggle a led in the interrupt routine. void SysTick_Handler(void) { STM32_Discovery_LEDToggle(LED4); } As I understand it the systick timer is being clocked at 1/3MHz and the divider above (24MHz/20,000 = 1200) should give me a repition rate of .33usecs * 1200 = 400usecs., but the led is switching every 60 usecs. I've obviously missed something, but what? I'm using the RM0041 reference manual for the device and although it refers to the SysTick registers it doesn't describe them in detail as it does for the RCC registers. Have I the wrong manual? Thanks for your help Alastair2010-11-11 04:49 PM
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
if (SysTick_Config(SystemCoreClock / 20000))
{
/* Capture error */
while(1);
}
You'll need to change the order of that, because SysTick_Config() sets the clock source to be HCLK
2010-11-12 03:36 AM
2010-11-12 05:13 AM