Skip to main content
SSmit.13
Senior
December 12, 2023
Solved

How to I disable the USB on the STM32L4

Hi

 I am using the USB CDC on a STM32L433 with the command MX_USB_DEVICE_Init(); to communicate through the USB. In my app, I go into standby mode (by using the HAL_PWR_EnterSTANDBYMode()) command. How do I disable the USB before entering standby?  I tried the the command USBD_DeInit(&hUsbDeviceFS) , but got a hardware fault. Anyone let me know the best way to disable it?

 

Best Regards

Scott

This topic has been closed for replies.
STTwo-32
STTwo-32Best answer
ST Technical Moderator
December 12, 2023

Hello @SSmit.13 

I suggest you set the USBFSRST High then Low to reset the USB FS and set the USBFSEN Low to disable the USB FS clock.

Best Regards.

STTwo-32

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.

2 replies

STTwo-32
STTwo-32Best answer
ST Technical Moderator
December 12, 2023

Hello @SSmit.13 

I suggest you set the USBFSRST High then Low to reset the USB FS and set the USBFSEN Low to disable the USB FS clock.

Best Regards.

STTwo-32

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.
SSmit.13
SSmit.13Author
Senior
December 14, 2023

That worked, many thanks

 

Scott