Skip to main content
Explorer II
June 12, 2025
Solved

Debugging for Nucleo-H7S3L8 USB implementation

  • June 12, 2025
  • 1 reply
  • 421 views

I am verifying USB implementation using Nucleo-H7S3L8.

When I executed CDC_Standalone in STM32CubeH7RS using the Debug button and ran the Appli code, the function “HAL_PWREx_EnableUSBVoltageDetector()” in ‘MX_USBPD_Init()’ did not return HAL_OK and an error occurred.Within this function, the “USB regulator ready flag (PWR_CSR2_USB33RDY)” is not set, causing a timeout and resulting in a HAL_ERROR.

However, when I stop debugging, disconnect the USB cable, and reconnect it, the COM port appears in the Windows Device Manager.

I have not made any changes to the contents of CDC_Standalone.
The jumper on JP3 on the board has been changed from STLINK to UCPD.

What should I do to properly debug USB on this board?

 

error.png

    This topic has been closed for replies.
    Best answer by FBL

    Hi @yamamo2shun1 

    It seems the example is setting USB33DEN twice in HAL_Init() and in HAL_PCD_MspInit(). Ensure that you remove the redundant call to HAL_PWREx_EnableUSBVoltageDetector() from one of the locations to avoid unnecessary duplication.

    According to the reference manual, USB33DEN bit should be set if USB HS, FS, or a GPIO on port M is used. USBHSREGEN should only be set if USB HS is used.

    So, when simply using port M as GPIO, you should keep the call in HAL_Init(). Otherwise, you can keep it in PCD_MspInit().

    This FAQ about voltage regulator, specifically section 2.2 STM32H7RS use case might explain some clock configuration as well.

    About JP3, it is necessary in host mode, to ensure providing sufficient VBUS supply through external source.

    1 reply

    FBLAnswer
    Technical Moderator
    June 12, 2025

    Hi @yamamo2shun1 

    It seems the example is setting USB33DEN twice in HAL_Init() and in HAL_PCD_MspInit(). Ensure that you remove the redundant call to HAL_PWREx_EnableUSBVoltageDetector() from one of the locations to avoid unnecessary duplication.

    According to the reference manual, USB33DEN bit should be set if USB HS, FS, or a GPIO on port M is used. USBHSREGEN should only be set if USB HS is used.

    So, when simply using port M as GPIO, you should keep the call in HAL_Init(). Otherwise, you can keep it in PCD_MspInit().

    This FAQ about voltage regulator, specifically section 2.2 STM32H7RS use case might explain some clock configuration as well.

    About JP3, it is necessary in host mode, to ensure providing sufficient VBUS supply through external source.

    Explorer II
    June 13, 2025

    Hi @FBL 

    Thank you for your advice and useful tips!

     


    @FBL wrote:

    It seems the example is setting USB33DEN twice in HAL_Init() and in HAL_PCD_MspInit(). Ensure that you remove the redundant call to HAL_PWREx_EnableUSBVoltageDetector() from one of the locations to avoid unnecessary duplication.

    Commenting out HAL_PWREx_EnableUSBVoltageDetector() in HAL_Init() made it work properly!