Solved
How can I use USB (CDC) without the VBus connection on the STM32H755?
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?
I already saw https://community.st.com/t5/stm32-mcus-products/stm32h7-usb-cdc-without-vbus-pin/td-p/754880
So I believe this is possible.
