Detect unplugged USB cable

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User10683
Level 1
Level 1
Hi folks,

I am using the USB VCOM app in Dave 4 and I am trying to figure out how to detect that the USB cable has been pulled.
Any idea?

Matthias
0 Likes
1 Reply
User10683
Level 1
Level 1
Update!!

I originally posted the above, because the method USBD_VCOM_IsEnumDone() worked strange for me.
In fact it was only returning 0 for a short period after plugging in the USB cable, but never when I disconnected the cable.

So I dug a little deeper and it turned out, that the problem was the ESD protection device I used (USBLC6-2) which pulled the VBUS line to 2V with the cable disconnected.
That way the USB module was unable to detect the disconnection!

How are you folks protecting your device from ESD from the USB port?

Matthias
0 Likes