cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 SYSTICK CONFIG

moderato926
Associate
Posted on February 11, 2014 at 11:03

Hi everyone. I've encountered a problem. I am using the function systick_config to configure a accurate timer. In the main function I write

if (SysTick_Config(SystemCoreClock/1000)) 

        while (1);

    }

and the expected delay time is 1ms. However I got 10ms on the oscilloscope. I'm not sure what's wrong with my program. I compared my program with the example program given by ST and checked some parameters related to the clock frequency but found nothing different. There is no special configuration in my program. Could anyone tell me where the problem may possibly lie? Thank you :)

#stm32-systick
3 REPLIES 3
francescatodiego
Associate II
Posted on February 11, 2014 at 12:23

HSE frequency ?

Read the comment on top of system_stm32f4xx.c file Note 4

(All is set for clock = 25MHZ  if the clock is different you must redefine the HSE_VALUE constant)

You must call also SystemCoreClockUpdate() otherwise the SystemCoreClock value is wrong  

troy1818
Senior
Posted on February 11, 2014 at 14:36

Compare your actual board frequency with the value that is set in the variable SystemCoreClock. You can see what clk freq your board has by outputting MCO on a pin. You have a factor 10 error here I guess. If you do not do any configuration then it is hard to know board freq, but HSI should be used and is 16Mhz for stm32f407 i think.

ST have created an excel sheet + macros that can help with this (im not kidding about excel, unfortunately).

Regards,

/rygelxvi

Posted on February 11, 2014 at 16:16

The whole 1:10 thing is a bit confusing, but as indicated look at the settings in system_stm32f4xx.c and how they relate to the hardware on your board implementation.

Internal clocks can also be output via the MCO1/MCO2 pins, the maximum output rate is 100 MHz so there is also a 1-5x divider to get the clocks into range.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..