[STM32Cube/MX] PLLI2S is not enabled when MCO2 is configured from it
Hi!
I use an STM32F746 and I configured STM32CubeMX clock tree as is :

I just use PLLI2S for the MCO2 output (for Ethernet purposes). I don't use SAI1, SAI2, I2S or SPDIF-RX, so the HAL_RCCEx_PeriphCLKConfig function does not initialize PLLI2S:
HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit)
{
...
/*-------------------------------------- PLLI2S Configuration ---------------------------------*/
/* PLLI2S is configured when a peripheral will use it as source clock : SAI1, SAI2, I2S or SPDIF-RX */
if((plli2sused == 1) || (PeriphClkInit->PeriphClockSelection == RCC_PERIPHCLK_PLLI2S))
{
... // THIS SECTION IS NOT CALLED: plli2sused == 0 and PeriphClkInit->PeriphClockSelection is not strictly equal to RCC_PERIPHCLK_PLLI2S, although it contains it as a binary mask
}
...
}The workaround is to initialize it manually after the SystemClock_Config() call :
PLLI2SInit.PLLI2SN = 100;
PLLI2SInit.PLLI2SP = RCC_PLLP_DIV2;
PLLI2SInit.PLLI2SR = 2;
PLLI2SInit.PLLI2SQ = 2;
HAL_RCCEx_EnablePLLI2S(&PLLI2SInit);EDIT: actually it's a bug inside the HAL_RCCEx_PeriphCLKConfig function of STM32Cube HAL library, it should be:
if((plli2sused == 1) || (((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_PLLI2S) == RCC_PERIPHCLK_PLLI2S))(By the way, MCO2 GPIO speed must be set manually to "Very high" inside STM32CubeMX settings)
Thanks