2014-02-11 02:03 AM
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-systick2014-02-11 03:23 AM
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 wrong2014-02-11 05:36 AM
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,/rygelxvi2014-02-11 07:16 AM
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.