2015-07-10 02:01 AM
Hello everybody. I've found a little bug in the STM32F4xx standard peripheral library and since I'm not sure where to report it I decided to post it here.
So, this bug is located at STM32F4xx_DSP_StdPeriph_Lib_V1.5.1\Project\STM32F4xx_StdPeriph_Templates\system_stm32f4xx.c. It is said in its comments, forSTM32F40xxx/41xxx
devices
:* SYSCLK(Hz) | 168000000
*-----------------------------------------------------------------------------
* HCLK(Hz) | 168000000
*-----------------------------------------------------------------------------
...
*-----------------------------------------------------------------------------
* PLL_N | 336
but PLL_N is set actually to 360 in the following lines:
#if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx)
#define PLL_N 360
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 2
#endif /* STM32F40_41xxx || STM32F427_437x || STM32F429_439xx || STM32F446xx */
My STM32F417 MCU still runs well at the resulting frequency (180 MHz), but CMSIS-RTOS kernel functions are working incorrectly because of difference between SystemCoreClock variable value and actual core frequency.
Hope this will be corrected in the future releases.
#cmsis-keil-peripheral-library #!bug #stm32f4xx
2015-07-10 04:46 AM
Hello chernikov.vasily,
You are right; there is an error in the file system_stm32f4xx.c .It is noted and will be fixed in coming release of the STM32F4 standard peripheral library.Thanks-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2015-07-10 11:56 AM
This file is very bad created. It supports only boards from ST.
For example, if you want to use HSE oscillator on custom board using F411 (proper define for F411 is used), then HSE won't start, because Nucleo board does not have it and it is not implemented.I think this should be more generic created in a way:- Try to start HSE- Wait till start in some timeout value- If failed, use HSI and work as HSI is selected, use 16 as PLL_M and select HSI as PLL input clock- If success, use PLL_M value from user and select HSE as PLL input clockThat's how I did it and now it works for ALL boards in every configuration you want.