Frequency configuration for STM32
ST suggests using their XLS configurators that generate system_stm32xxxx.c file for you.
This generator can be found on http://st.com site if you need one for STM32L1xx the family you can use this one:
STM32L1xx_Clock_Configuration_V1.2.0.xls
You need Microsoft Excel. I use 2003, because had some issues with newer versions. Also, you need to enable Lower Macros level in Excel settings for making this work. Then you should open the file:
Some advice:
- Don't edit
PLLVCOmanually, for some reasonxlsallows it but you should not. ChangePLLMULinstead - If you need bigger frequencies change
Vcorefor bigger value. - Press generate and file
system_stm32l1xx.cwill be created near.xlsfile. Delate.cfile manually before generating it again.
Example generated config by settings used on the screenshot: system_stm32l1xx.c
For additional info read en.CD00290434.pdf