cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in the STM32F4xx std peripheral library

vech2001
Associate II
Posted on July 10, 2015 at 11:01

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, for

STM32F40xxx/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
2 REPLIES 2
Amel NASRI
ST Employee
Posted on July 10, 2015 at 13:46

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.

tm3341
Associate II
Posted on July 10, 2015 at 20:56

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 clock

That's how I did it and now it works for ALL boards in every configuration you want.