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-05 01:24 AM
,
,
Hello Imen,
I installed version 4.20.1. But the problem continues.
If I do not change the RCC line like this,it is waiting in the infinite
loop at the Error_Handler().
//RCC_OscInitStruct.OscillatorType =
RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE,
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE,
Thank you
Zekeriya Altınordu
4.04.2017 19:30 tarihinde Imen D yazdı:
>,
STMicroelectronics Community
<,https://community.st.com/?et=watches.email.thread>,
>,
Re: STM32F429 CLOCK CONFIGURATION PROBLEM
reply from Imen D
<,
in /STM32 MCUs Forum/ - View the full discussion
<,https://community.st.com/0D70X000006ScjCSAS
>,
2017-04-05 01:52 AM
Hi,
This issue is resolved with the new patch and I have checked this by creating a new project to have the correct configuration.
But, as you are using an old .ioc project, you should first EDIT the .ioc file and REMOVE this line (remove the RCC.OscillatorType that you don't need)
RCC.OscillatorTypeHSI=RCC_OSCILLATORTYPE_HSI
Then re-generate the project, this will resolve your problem.
Please keep me informed about your updates.
Best Regards
Imen
2017-04-05 03:02 AM
CubeMX 4.20.1 have solved this issue,
I just tried it
。2017-04-05 03:34 AM
After installing CubeMX 4.20.1, I saw that the problem persists. After a while, I noticed that the generated code came in the way Zhitai Liu proposed. Then I added USB OTG FS (Device only) and Class For FS IP (Mass storage Class) to the CubeMX project. In this case, when I install the generated code, STLinkV2 becomes inoperable with the processor. To return to the previous state, I am disassembling the crystal. In this case, STLinkV2 becomes operational again. I remove the USB related stuff from the project and generate the code again. After installing the generated code, when I plug in the crystal again, the processor becomes working again with HSE. I think the problem is now with USB, not with HSE work.
2017-04-05 05:20 AM
Okay, I modify the RCC settings to HSI and then re-modify to HSE again as I need and then regenerate the project, now it's working. Thanks Imen!
2017-04-05 02:09 PM
Did the STM32CubMX 4.20.1 not get posted to the auto-updater? When I Help >
Check for updates, I get nothing.
<>< <>< <><
Bryce Schober
On Tue, Apr 4, 2017 at 9:30 AM, Imen D <st-microelectronics@jiveon.com>
2017-04-06 02:45 AM
Hi
Schober.Bryce
,The patch STM32CubeMx 4.1 is available in the ST web and you can download it from this link
.Imen
2017-04-06 03:17 PM
When I originally asked, STM32CubeMx 4.20.1 was not found in the update
manager. Now it is.
<>< <>< <><
Bryce Schober
On Thu, Apr 6, 2017 at 2:55 AM, Imen D <st-microelectronics@jiveon.com>
2017-04-07 03:40 AM
Hi
Schober.Bryce
,This is due to the synchronization issue between CubeMx tool and the update of new version in the web.
Thanks
Imen