AnsweredAssumed Answered

STM32CubeMX Bug in Code Generation for NucleoF072

Question asked by eapperley on Dec 15, 2015
Latest reply on Dec 17, 2015 by cnoviello
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:

//#if 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;
//      }
//#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */



Eric

Outcomes