How do I change default clock settings?

Hi there!
Just starting to use STM32F429I-DISC1 board within MBED OS IDE (can I call it IDE?)
When measuring calculation speed I wandered: what is the default clock settings for my firmware? Looks like it is the maximum 180 MHz as the integer multiplication needs only 40 ns to execute or so. However I’d like to check it to be sure.
But much more important for me is to be able to control the clock setting with IDE (like Project/Settings menu or so) and/or in the code like

cpu_set_clock(8000000); // or
cpu_sleep(1000); // sleep and save energy for 1000 microseconds

All the functions above are just my assumption of what it could look like.

I made some search in the web (nothing useful was found) and made the post at Stack Exchange (I was proposed to use HAL which I’m not familiar with).

Why do I think it is important? It can be required in low power applications.
Why it can be important to be settable from the IDE? If I have only weak power source I will be forsed to use extra capacitors to provide power for startup period. Making the power consumption low from the very start would be a good practice for cheaper schematic.

Thank you in advance!

Roman,
Your system clock settings are defined in system_clock.c

Look at your specific MCU’s datasheet to determine how to properly set it up. In this file you’ll see precompiler defines that determine which code gets ran, most importantly “CLOCK_SOURCE” and whichever clock source your board is using (typically “USE_PLL_MSI”). This is defined in mbed_config.h and you can modify it appropriately here. The documentation within clock_source.c is also a quick reference to the system’s clocks.

Though it is possible, I don’t recommend modifying any of the source files in the mbed library. An alternative would be to create your own local copy of the source file and include it in your project, then remove the original file from the project.

Good luck!

1 Like

Hi, Stephen!
Thank you for your replay!
I tried to find system_clock.c and mbed_config.h files in the project tree, but no success :(((
However I was able to find mbed_config.h in the archive which I downloaded with Export Program → Export toolchain = ZIP archive.
The exported tree contains much more files that I can see in the IDE:

2019-03-30_00-13-32

Does anybody know why?