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.
3 years ago.
How to set up stm32L4 in Run mode 2 (26 Mhz)?
Can someone please guide me how to set up stm32L4 in Run mode 2 (26 Mhz)? If there is a source code and libraries for that it would be great. I could only find codes for the lowpower run mode (around 8 Mhz I think) and other sleep and stop modes .
3 years ago.
I'm not sure what you mean by run mode 2. If you work from the mbed-os source code, you can make changes to oscillator configuration deep in the target folder in the file: system_stm32l4xx.c. You should be able to just tweak some of the PLL values and bring down the clock frequency. You can see in the function SetSysClock(void), it tries to start the micro using different oscillators based on #define settings. If the first oscillator fails to start it tries the next one. Figure out which oscillator you want to use and update that initialization routine. It's pretty straightforward. All of the clocks should already be using the PLL so to change main oscillator you can just tweak PLLN and PLLR and get a wide range of frequencies.
Also, you can setup a project in ST's CubeMx with that micro and pull up the clock configurator which gives you a nice graphic of how all the PLL settings work.