2016-10-17 06:50 AM
Is there any method ( library function, variable, or other) to check
if USB2.0 HS MSC connection is established or not ? I want to turn-on / off a LED on the board upon USB connection status. THANKS....2016-10-18 03:49 AM
Hi chun.dan
,If you want to know if you have a device is either connected or disconnected, use can a global variable inside both HAL_PCD_ConnectCallback() andHAL_PCD_DisconnectCallback()
.
If USBD_LL_DevConnected status is USBD_OK you should change the value of the global variable to 1 (or whatever you prefer). You should write the code to update this global variable into every related callbacks.HAL_PCD_CconnectCallback() is called inside HAL_PCD_IRQHandler() (stm32f4xx_hal_pcd.c), by GOTGINT.SEDET (session end detected) interrupt
.To ensure this interrupt is fired you need the following requirement:
-Hannibal-