I think I've found a bug in the STM32F4xx/hal_lld.h header, namely, in the following code:
Code: Select all
#if (STM32_MCO2SEL == STM32_MCO2SEL_HSI) || \
((STM32_MCO2SEL == STM32_MCO2SEL_PLL) && \
(STM32_PLLSRC == STM32_PLLSRC_HSI))
#error "HSI not enabled, required by STM32_MCO2SEL"
#endif
The MCO2 doesn't support outputting the HSI clock, so STM32_MCO2SEL_HSI isn't defined (which is correct). The code above checks the value of STM32_MCO2SEL_HSI, which is zero by default (the same value as STM32_MCO2SEL_SYSCLK). Of course, the PLL output can be routed to MCO2, and the PLL can have the HSI as its source, so maybe the code should be modified to:
Code: Select all
#if ((STM32_MCO2SEL == STM32_MCO2SEL_PLL) && \
(STM32_PLLSRC == STM32_PLLSRC_HSI))
#error "HSI not enabled, required by STM32_MCO2SEL"
#endif
Thanks!
Diego.