USB disconnection detection

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

cross mob
User8819
Level 4
Level 4
Hello,

In xmc4400 manual is written that in DEVICE mode when VBUS is switched off (connector unplugged) OTG interrupt is triggered (bit 2 gintsts). I do not get this interrupt even if it is properly enabled.

1. Does this behavior depend on pin P0.9 status ID connection? Because in my case it is pull up to 3.3.

2. I am using USBD app witch is correctly working, how to detect USB disconnection without using P0.9 ID pin?

3. Suggestion to use usbreset interrupt suggested on this forum is also not triggered when disconnected.

rum
0 Likes
2 Replies
lock attach
Attachments are accessible only for community members.
Not applicable
Hi,

Q1) This pin (P0.9) should not be pull-up. The OTG ID pin is used only for the USB dual role device; where in it should support device mode and host mode functionality depending on the ID pin.
Please note that currently our XMC_LIB for USB only supports USB device functionality and doesn’t support OTG functionality.

Q2) You will need to add an event callback for USB disconnect event. (Example attached)
With this, whenever then user unplug the USB cable, the disconnect event will be entered.

Q3) In a self-powered USB device, the reset event can be used to support device functionality for disconnect-connect back, which is basically a re-initialization of the USB.

Regards,
Daryl
0 Likes
Not applicable
Hi Daryl !
My Software also freezes, if you unplug the usb connector.
I've downloaded your example, but i can't find any event callback for USB disconnect event.
Where is it?
Regards,
Michael
0 Likes