cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U535 random hard fault when running at 160 MHz

Fabrice_GIRARDOT
Associate

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.

Capture d’écran de 2024-02-20 08-01-21.png

On the same board, with STM32U535CEU6QTR; no problem with HCLK set to 160 MHz.

Capture d’écran de 2024-02-20 08-01-25.png

Here is the MCU power supply (same for both boards revision) :

Capture d’écran de 2024-02-20 08-03-44.png

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Check VCAP parts actually placed.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4

Check VCAP parts actually placed.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gbm
Lead III

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.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Fabrice_GIRARDOT
Associate

Hi, and thanks for your reply.

VCAP capacitor is close to MCU :

Capture d’écran de 2024-02-20 08-54-19.png

On the actual board, it is present :

STM32U5.png

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 !

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.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice