Rudy Barbieri

Is unsafe to call USBD_Stop followed by USBD_DeInit

Discussion created by Rudy Barbieri on Apr 12, 2018

I'm working with an STM32F412 MCU.

 

The application use the USB as a drive. with cube the USB is initializated with the function MX_USB_DEVICE_Init();

 

In certain situations, I need to deinit the USB so I call in sequence:

 

  USBD_Stop(&hUsbDeviceFS);
  USBD_DeInit(&hUsbDeviceFS);

 

I have noticed that the USBD_DeInit calls the function MSC_BOT_DeInit which accesses to pdev->pClassData that is NULL.

 

Is the call to USBD_Stop that frees the pointer and sets it to NULL.

 


What is the correct way to DeInit the USB?

Outcomes