2017-03-26 11:43 PM
I am trying to configure HSE clock with 8Mhz crystal with STM32F429.
HAL_ERROR occurs when HAL_RCC_OscConfig function is executed in the following partition./*----------------------------- HSI Configuration --------------------------*/
if(((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) { /* Check the parameters */ assert_param(IS_RCC_HSI(RCC_OscInitStruct->HSIState)); assert_param(IS_RCC_CALIBRATION_VALUE(RCC_OscInitStruct->HSICalibrationValue)); /* Check if HSI is used as system clock or as PLL source when PLL is selected as system clock */ if((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_HSI) ||\ ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLL) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSI))) { /* When HSI is used as system clock it will not disabled */ if((__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) != RESET) && (RCC_OscInitStruct->HSIState != RCC_HSI_ON)) { return HAL_ERROR;//Always this line works }Actually HSE is running and ready, but the problem in HSI causes HAL_ERROR to return.
Error_Handler () is constantly running in this section with the reason for this problem.
/**Initializes the CPU, AHB and APB busses clocks
*/ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 8; RCC_OscInitStruct.PLL.PLLN = 336; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLQ = 7; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); }I need help
Thank you
Solved! Go to Solution.
2017-04-04 09:29 AM
Hello All,
I would inform you that a new patch
V 4.20.1 is available to fix this issue.Sorry for any inconvenience this may cause you.
Imen
2017-03-27 01:27 AM
Hello,
This is confirmed bug in clock configuration with
CubeMx 4.20 and will be fixed soon
in the new patch release.
We apologize for any inconvenience this may cause.
Imen
2017-03-27 01:28 AM
Hey,
I got this problem too in Nucleo STM32F446.
I solved it by modifying the followings:
Change
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;
to:
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
2017-03-27 03:48 AM
Thank you Zhitai Liu for reply but,
When I make this change, the processor becomes completely inoperable. It becomes flashing impossible. In order to get rid of this situation, I dismount the crystal and take it back again and start it again. So the processor becomes operational again. After that I put the crystal back in place. So I can get back to the beginning of the problem.
2017-03-27 07:26 AM
Hi!
I confirm that this bug is also present for STM32F072RB micros.
Thanks!
2017-03-29 05:43 PM
DAHMEN.IMEN
: Do you have an ETA for this patch release?2017-04-03 09:53 AM
Liu.Zhitai
thank you. I make this change and all is ok!2017-04-04 04:08 AM
I tried your solution again and this time it worked. I think crystal was a problem before. Thank you
2017-04-04 09:29 AM
Hello All,
I would inform you that a new patch
V 4.20.1 is available to fix this issue.Sorry for any inconvenience this may cause you.
Imen
2017-04-04 06:44 PM
Does any one check that CubeMX 4.20.1 really solve this issue?
In my F446 project, I still need to comment out
RCC_OSCILLATORTYPE_HSI| to make HSE configured.