cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect USB plugin and unplug (stm32L152)

kevinliao
Associate II
Posted on January 01, 2016 at 15:57

Hi All,

How to detect USB plugin and unplug?

I used the stm32L152 and USB CDC class.

I want to show plugin information on OLED, need to know when the usb plugin and unplug, but I can't find the solution?

I used a flag to check event at HAL_PCD_ConnectCallback() and HAL_PCD_DisconnectCallback(), but not work.

Thank you for your answer!

#stm32l152 #usb #plugin
1 REPLY 1
Walid FTITI_O
Senior II
Posted on June 13, 2016 at 16:47

Hi liao.chengyi,

I recommend that you refer to these threads that may be helpful for you:

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/USB%20CDC%20class%20How%20to%20determine%20if%20VCP%20has%20been%20opened&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE...

, [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/STM32F4%20Cube%20USB%20Device%20library&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&currentviews=501]thread2,

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Virtual%20Com%20Port%20-%20Detect%20USB%20Disconnect&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&cu...

-Hannibal-