Skip to main content
Associate II
October 7, 2025
Solved

How can I use USB (CDC) without the VBus connection on the STM32H755?

  • October 7, 2025
  • 1 reply
  • 329 views
Post edited by ST moderator to be inline with the community rules especially with the code sharing. In next time please use </> button to paste your code. Please read this post: How to insert source code

I am trying to use USB(CDC) without  the VBus connection on the STM32H755(Nuclueo-H755ZI-Q).
But I can't.
Please tell me the correct confinglation and procedure
 
I use ST USB middleware with CDC class.
There is no sample project for STM32H755.
So I ported myself.
It worked.(with VBus)
 
I changed following points for using without VBus.
 
comment out following.(main() "main.c")
HAL_PWREx_EnableUSBVoltageDetector();
 
comment out followings.(void HAL_PCD_MspInit(PCD_HandleTypeDef * hpcd) "usbd_conf.c")
/* Configure VBUS Pin */
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
And I checked this.
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef * pdev) "usbd_conf.c"
hpcd.Init.vbus_sensing_enable = 0;
                                                    ~~~
* this value was already "0".
 
At first, it seemed to work,
But that was wrong.
 
After running code with VBus enabled, if you debug-execute code with VBus disabled in CubeIDE without powering off, it works. However, it fails to run after powering off.
 
I have experience running USB without VBus on STM32L4 and STM32F4.
On those models, simply setting
hpcd.Init.vbus_sensing_enable = 0;
 made it work.
 
I think STH32H755 requires other procedure.
Does anyone know about this?
So I believe this is possible.
Best answer by Gyessine

Hello, @JE2 
Can you specify whether the USB device is bus-powered or self-powered? and if self-powered , can you provide the GPIO pin that you are using?

Because based on AN4879section 2.6
a USB device must use VBUS sensing detection. There are two cases:

  • Bus-powered USB device: VBUS sensing is not mandatory because USB is always connected when the device is powered.
  • Self-powered USB device: VBUS sensing is mandatory.

However, I tried replicating your case on my end, and I did not encounter any problems. I am attaching the project in case it can help you.

Gyessine

1 reply

GyessineBest answer
Technical Moderator
October 10, 2025

Hello, @JE2 
Can you specify whether the USB device is bus-powered or self-powered? and if self-powered , can you provide the GPIO pin that you are using?

Because based on AN4879section 2.6
a USB device must use VBUS sensing detection. There are two cases:

  • Bus-powered USB device: VBUS sensing is not mandatory because USB is always connected when the device is powered.
  • Self-powered USB device: VBUS sensing is mandatory.

However, I tried replicating your case on my end, and I did not encounter any problems. I am attaching the project in case it can help you.

Gyessine

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.
JE2Author
Associate II
October 14, 2025

Thank you Gyessine!

It worked!

I ported just a following point from "H755_CDC.zip".

 

In usbd.conf

My original code(This is STM32Cube's code(STM32Cube_FW_H7_V1.11.0) as is, unchanged.)

/**
 * @brief Suspend callback.
 * @PAram hpcd: PCD handle
 * @retval None
 */
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef * hpcd)
{
 USBD_LL_Suspend(hpcd->pData);
}

 

Gyessine's solution

void HAL_PCD_SuspendCallback(PCD_HandleTypeDef * hpcd)
{
 USBD_LL_Suspend(hpcd->pData);
 __HAL_PCD_GATE_PHYCLOCK(hpcd);
 /* Enter in STOP mode. */
 /* USER CODE BEGIN 2 */
 if (hpcd->Init.low_power_enable)
 {
 /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register. */
 SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
 }
 /

Thanks!

JE2Author
Associate II
October 14, 2025

I didn't answer the Gyessine's question.

I'm developing a self-powered device.

The pins used for USB are:

  • PA11 USB DM
  • PA12 USB DP

You wrote this configuration requires VBus sensing.

Now I'm using Nuclueo-H755ZI-Q. This board has its VBus pin(PA9) physically connected.

I will check again when I get our prototyped board.