Skip to main content
Graduate II
December 12, 2023
Solved

How to I disable the USB on the STM32L4

  • December 12, 2023
  • 1 reply
  • 1200 views

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.
    Best answer by STTwo-32

    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

    1 reply

    STTwo-32Answer
    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

    SSmit.13Author
    Graduate II
    December 14, 2023

    That worked, many thanks

     

    Scott