2015-12-15 10:10 AM
There is a defect in the initialisation code that STM32CubeMZ generates for an STM32F072RB target if the high-speed external clock is selected.
For some reason the code expects a value for constant 'HSI48_VALUE', even though the high-speed internal clock is not in use:Drivers\CMSIS\Device\ST\STM32F0xx\Source\Templates\system_stm32f0xx.c
In function 'SystemCoreClockUpdate':
Drivers\CMSIS\Device\ST\STM32F0xx\Source\Templates\system_stm32f0xx.c|287
error: 'HSI48_VALUE' undeclared (first use in this function)
Drivers\CMSIS\Device\ST\STM32F0xx\Source\Templates\system_stm32f0xx.c|287
The workaround at this stage is to comment out the conditional code block in the file 'system_stm32f0xx.c' thus:
//&sharpif defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) // else if (pllsource == RCC_CFGR_PLLSRC_HSI48_PREDIV) // { // /* HSI48 used as PLL clock source : SystemCoreClock = HSI48/PREDIV * PLLMUL */ // SystemCoreClock = (HSI48_VALUE/predivfactor) * pllmull; // } //&sharpendif /* STM32F042x6 || STM32F048xx || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */Eric
#!stm32-!cubemx-!stm32f072-!bug2015-12-17 05:29 AM
Hi eapperley,
I cannot reproduce the reported issue selecting HSE as clock source for Nucleo_F072 board.Could you please share your .ioc file?-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-12-17 07:35 AM
I also confirm the issue, which is not properly a bug. It's caused by the fact that the
HSI48_VALUE
macro is defined inside the stm32f0xx_hal_conf.h, which is not included by the system_stm32f0xx.c.However, the right workaround is to add stm32f0xx_hal_conf.h as include file using the GCC parameter -include (-include''../include/stm32f0xx_hal_conf.h''
), and not decommenting that line of code.Hope it helps.