cancel
Showing results for 
Search instead for 
Did you mean: 

How to check the USB connect/disconnect run time?

Bhushan
Associate II

Hi,

We are using STMCubeMX to generate the code for USB-Device Mass Storage class for STM32L4R5 controller.

We have to check the usb connect/disconnect status run time.

Try to use HAL_PCD_ConnectCallback/HAL_PCD_DisconnectCallback function but never get call back here.

Please suggest how to use these call back function or any other method to check the USB status?

Thank you.

1 REPLY 1

Evaluate (hUsbDevicexx.dev_state==USBD_STATE_CONFIGURED) if zero or not zero

hUsbDevicexx is the USBD_HandleTypeDef handle of the device.