2024-02-19 11:32 PM
Hello.
On a custom board with STM32U535CEU6TR, I can't have HCLK set to 160 MHz. At that speed, I get random hard faults. If I set HCLK to 80 MHz, then everything is fine, no more random hard faults.
On the same board, with STM32U535CEU6QTR; no problem with HCLK set to 160 MHz.
Here is the MCU power supply (same for both boards revision) :
Clock initialization is borrowed from CubeMX generated code :
/* Init HAL */
HAL_Init();
/* Configure the internal regulator output voltage */
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
/* Initialize main PLL */
RCC_OscInitTypeDef RCC_OscInitStruct = { 0, };
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLMBOOST = RCC_PLLMBOOST_DIV1;
RCC_OscInitStruct.PLL.PLLM = 4;
RCC_OscInitStruct.PLL.PLLN = 40;
RCC_OscInitStruct.PLL.PLLP = 2;
RCC_OscInitStruct.PLL.PLLQ = 2;
RCC_OscInitStruct.PLL.PLLR = 1;
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLLVCIRANGE_0;
RCC_OscInitStruct.PLL.PLLFRACN = 0;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
/* Connect HCLK SYSCLK PCLK1 PCLK2 and PCLK3 to PLL output */
RCC_ClkInitTypeDef RCC_ClkInitStruct = { 0, };
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK |
RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 | RCC_CLOCKTYPE_PCLK3;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB3CLKDivider = RCC_HCLK_DIV1;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4);
With STM32U535CEU6TR, if I change this line ...
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
... to this line ...
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV2;
... then I don't get random hard faults, but I don't have the expected clock frequencies I need.
For what I know, difference between Q and non-Q versions of this MCU is the non-Q version has no embedded SMPS voltage regulator. I'm not changing it, not calling HAL_PWREx_ConfigSupply(), so I assume it is set to the default reset value "LDO" (PWR_CR3 bit REGSEL).
I monitored with an oscilloscope the MCU 3V3 power supply and can't identify any issue with it.
Any help would be greatly appreciated.
Solved! Go to Solution.
2024-02-19 11:41 PM
Check VCAP parts actually placed.
2024-02-19 11:41 PM
Check VCAP parts actually placed.
2024-02-20 12:09 AM
Check if BOOSTEN bit is set in PWR->VOSR.
I have just realized that I run my U545 at 240 MHz by mistake, without any problems.
2024-02-20 01:09 AM
Hi, and thanks for your reply.
VCAP capacitor is close to MCU :
On the actual board, it is present :
Thanks to your hint, I discovered that this capacitor is 10 µF while datasheet says 4.7 µF.
Changed to 4.7 µF and voilà ! MCU is now running fine at 160 MHz ! \o/
Thanks a lot !
2024-02-20 01:31 AM
I would rather suspect a cold joint corrected as a side effect of your fixes. Usually, but not always, bigger capacitance is better in these places.