Skip to main content
Associate
August 13, 2026
Question

STM32U3 + USBX device: init step missing from the generated HAL PCD code?

  • August 13, 2026
  • 3 replies
  • 81 views

Hi,

I'm bringing up a USB MSC device on an STM32U385CGT6 with the USBX middleware in standalone mode. Everything comes from CubeMX 6.18.0 with STM32Cube FW_U3 V1.4.0 (USBX 6.4.0): USB_DRD_FS in device mode, USBX Core System + UX Device CoreStack + UX Device Controller + UX Device MSC.

While comparing the generated code and some example applications (NUCLEO-U385RG-Q Ux_Device_HID_Standalone) it looks there is a regression in the generated HAL_PCD_MspInit. While the version from the example application enables Vdd USB, this is missing from the currently generated version of HAL_PCD_MspInit causing the peripheral to remain powered down. 

As a fix HAL_PWREx_EnableVddUSB(); can be called in the user code section at the bottom of HAL_PCD_MspInit.

 

Best Regards, Cecil

3 replies

Ghofrane GSOURI
ST Technical Moderator
August 13, 2026

Hello ​@CecilW 

I have performed a test using the latest version of STM32CubeMX 6.18.1 and the line of code does exist in the generated code as shown below 

I am sharing with you my IOC.

I will be waiting for your feedback.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
CecilWAuthor
Associate
August 14, 2026

Hi Ghofrane,

Thank you for the fast responce.


I did some tests with your ioc file and i think i found the source of the bug. To reproduce it simply go to “Project Manager → Code Generation → Generated Files” and enable “Generate peripheral initialization as a pair of ‘.c/.h’ files per peripheral”
With it enabled the USB PCD MSP init function lands in usb.c and is missing the HAL_PWREx_EnableVddUSB call.

Best Regards, Cecil

Ghofrane GSOURI
ST Technical Moderator
August 14, 2026

Hello ​@CecilW 

Your contribution is much appreciated.

Issue has been escalated to dev team under internal ticket ID #0065111 for resolution.

I will keep you posted with updates.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.