Skip to main content
therealergo
Associate II
Question

STM32CubeMX 6.19.0 Generated Code for MDF on STM32U535VCI6Q Enables Wrong PLL

When generating code for the MDF peripheral clocked from PLL3 on the STM32U535VCI6Q using STM32CubeMX 6.19.0, the following code is generated:

    PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_MDF1;
PeriphClkInit.Mdf1ClockSelection = RCC_MDF1CLKSOURCE_PLL3;
PeriphClkInit.PLL3.PLL3Source = RCC_PLLSOURCE_HSE;
PeriphClkInit.PLL3.PLL3M = 5;
PeriphClkInit.PLL3.PLL3N = 128;
PeriphClkInit.PLL3.PLL3P = 10;
PeriphClkInit.PLL3.PLL3Q = 10;
PeriphClkInit.PLL3.PLL3R = 2;
PeriphClkInit.PLL3.PLL3RGE = RCC_PLLVCIRANGE_0;
PeriphClkInit.PLL3.PLL3FRACN = 0;
PeriphClkInit.PLL3.PLL3ClockOut = RCC_PLL3_DIVP;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}

The MDF peripheral, however, is connected to PLL3Q, not PLL3P. As a result of the incorrect generated value for “PLL3ClockOut,” PLL3Q is not enabled and PLL3P is enabled instead, causing the peripheral to fail to operate.