cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in stm32f4xx_hal_rcc.c/version V1.4.3

ruben_kh62
Associate
Posted on January 30, 2016 at 23:13

See line 678 :

while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_SYSCLKSOURCE_STATUS_PLLRCLK)

 

The intend is to  check System clock switch status (SWS field of RCC_CFGR)  after writing to System clock switch (SW field of RCC_CFGR). But the definition of RCC_SYSCLKSOURCE_STATUS_PLLRCLK

is wrong. As a result that statement never gets false which leads to timeout. In turn, that leads to skipping initialization of PPRE1 and PPRE2 of RCC_CFGR. The consequence  is:  APB1 and APB2  clocks are the same as AHB clock when AHB prescaler = 1.  So, if SYSCLK is 180 MHz the APB1 will run at the same clock (should be 45 MHz max) ! Wow!

Conclusion: The definition of  RCC_SYSCLKSOURCE_STATUS_PLLRCLK

s

hould point to bits 3:2 instead of 1:0 of RCC_CFGR register 

#stm32f4x-hal-library
1 REPLY 1
Amel NASRI
ST Employee
Posted on February 01, 2016 at 12:38

Hikhazhakyan.ruben,

I confirm the reported issue. In fact,RCC_SYSCLKSOURCE_STATUS_PLLRCLK has to be defined as:

#define RCC_SYSCLKSOURCE_STATUS_PLLRCLK ((uint32_t)(RCC_CFGR_SWS_0 | RCC_CFGR_SWS_1)) /*!< PLLR used as system clock */

This bug is reported internally and will be fixed in a coming release. Thanks for your interest on our solutions. -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.