Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 4 months ago.
How do I change the bloody clock frequency.
Hello everyone. I have a Nucleo-F446RE. It is currently running at 180 MHz, however, I would like to run it much slower, as it is effecting the GPS lock in a project (too noisy). I managed to copy and paste some code form STM32CUBE to generate around 16 MHz. Kind of worked, I got a GPS lock but the rest of the code, ie output to the PC terminal is not working and I don't really know what I'm doing, just guessing. What is the easiest and best way to change the frequency in mbed. I can't find it. Regards Mark. Thanks.
Question relating to:
1 Answer
7 years, 4 months ago.
There is no mbed API for doing this so you're going to need to call one or more of the ST HAL functions.
If you want the clock to be set from out-of-reset then you will need to alter the system_stm32f4xx.c defines for the various clock registers. Or you can call the HAL_RCC_ClockConfig function after you enter main.
The sources for these can be pulled in from "mbed-dev" if you are running mbed2. If you want to run mbed5 then the sources are on GitHub. There are some good threads on here on how to pull these in locally into your project....
The other thing you might need to do is download STM32CubeMX from ST.com and open the pre-defined project for the F446RE Nucleo board. From there click on the clock configuration and get the correct low-level divider values you are going to need.
Hopefully that points you in the right direction for now...
Dear Bill, Thank you. I was using STM32CubeMX to get the correct values, and plan on using it as a visual tool to make sure they are correct until I get used to the settings. It compiles and my GPS now instantly get's a lock but the pc baud is not at say 9600 any more. Thanks for your direction I will check out GitHub and mbed-dev after looking in system_stm32f4xx.c . Regards Mark.
I just checked out "system_stm32f4xx.c" I think all the answers I need are there. That was easy, thanks again Bill. Regards Mark
posted by 07 Jul 2017
Since I can't comment on my comment :( If the baud is not working then one of the peripheral clocks is getting the wrong clock value. Here is how I made mine run at 50MHz out-of-reset
50MHZ changes for F446RE in SetSysClock_PLL_HSE