This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32F407 discovery board core clock setting

Hello,

I am experimenting with the STM32F407 discovery board. In order to run the sine.uvproj to get correct timing information, I tried to change the program settings for the correct hardware Xtal frequency which is 8 MHz instead of 25 MHz in the program supplied. Here are what I did:

1) In file "stm32f4xx.h"
change
#define HSE_VALUE ((uint32_t)25000000)
to
#define HSE_VALUE ((uint32_t)8000000)

2) In file "system_stm32f4xx.c
Change
#define PLL_M 25
to
#define PLL_M 8

3) In file RTX_Conf_STM32F4.c
Change #define OS_CLOCK 53760000
to #define OS_CLOCK 168000000

4) Set the "Core Clock" to 168000000 in the Trace Tab of Cortex-M Target Driver Setup

I ran the program, the waveform in the Analyzer was completely srewed up. I was able to get a nice sine wave previously (the frequency of the waveform is incorrect due to the CPU clock setting) but never the less, I got a sine wave. So somthing else in the program need to be changed and I can not figure out where and what.

Please help.

Thanks

Jim

  • Hello Jim Wei,

    Your changes seem to be OK.

    I also updated the Sine Project and it worked for me. The output in the Logic analyzer looked fine. What I did was the following:

    • replaced system_stm32f4xx.c with the one from C:\Keil\ARM\Boards\ST\STM32F4-Discovery\Blinky.
    • changed define OS_CLOCK in file RTX_Conf_STM32F4.c to 168000000
    • set the defines STM32F40XX and HSE_VALUE=8000000 in uVision Tab 'Options for Target - Preprocessor Symbols - define
    • changed Core Cloc in uVision Tab Cortex-M Target Driver Setup - Trace to 168.000000. Resulting SWO clock was 2.000000MHz.

    Best Regards, Martin Guenther