Not applicable
Jun 30, 2017
07:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 30, 2017
07:32 AM
Scenario: The XMC45 is connected to a PC using a USB cable. The cable is then removed. I want to detect this event, but how?. I've seen several similar questions on the forum, but no satisfactory answer.
I'm OK with a workaround solution.
I've tested with polling for the SOF interrupt, but it is generated even if Host is removed, which I find a bit odd.
I'm OK with a workaround solution.
I've tested with polling for the SOF interrupt, but it is generated even if Host is removed, which I find a bit odd.
9 Replies
Jul 01, 2017
11:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 01, 2017
11:22 AM
Not applicable
Jul 02, 2017
11:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 02, 2017
11:18 PM
Thanks for the answer, but no. I'm not interested in detecting the event on the PC. I'm only interested in detecting it on the XMC45. The title of this thread was a bit ambigous - sorry for that.
Jul 04, 2017
02:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 04, 2017
02:10 AM
Hi,
If you have the USB_ID connected as below, the connection/disconnection is indicated by the Interrupt Register (GINTSTS)
Otherwise you will need to use a software procedure which is described in the reference manual of the XMC4200_XMC4100, section 13.4.3 Device Disconnection.
Regards,
Jesus
If you have the USB_ID connected as below, the connection/disconnection is indicated by the Interrupt Register (GINTSTS)
Otherwise you will need to use a software procedure which is described in the reference manual of the XMC4200_XMC4100, section 13.4.3 Device Disconnection.
Regards,
Jesus
Not applicable
Jul 04, 2017
04:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 04, 2017
04:19 AM
Thanks for the answer.
I don't see how a pull up on the ID pin, as suggested in the picture, would help. The ID pin should be floating both when USB cable is inserted and when it is removed. The solution in the picture seems to be for detecting USB A-plugs (OTG), which is only useful if acting as a Host.
Section 13.4.3 of the XMC4200_XMC4100 reference manual suggests that the GINTSTS.USBRst interrupt should be generated after the removal of the cable. Unfortunately, no such interrupt is generated on the XMC45 when cable is removed.
I don't see how a pull up on the ID pin, as suggested in the picture, would help. The ID pin should be floating both when USB cable is inserted and when it is removed. The solution in the picture seems to be for detecting USB A-plugs (OTG), which is only useful if acting as a Host.
Section 13.4.3 of the XMC4200_XMC4100 reference manual suggests that the GINTSTS.USBRst interrupt should be generated after the removal of the cable. Unfortunately, no such interrupt is generated on the XMC45 when cable is removed.
Jul 05, 2017
09:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 05, 2017
09:53 AM
Have you enabled the GINTSTS.USBRst interrupt?
Not applicable
Jul 06, 2017
11:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 06, 2017
11:01 PM
Yes, the GINTSTS.USBRst interrupt is enabled.
Not applicable
Sep 29, 2017
07:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 29, 2017
07:29 AM
For some reason, I do get the GINTSTS.OTGInt interrupt when removing the cable from another PC Host. The interrupt won't fire if cable is removed from my main PC Host. Very odd.
Not applicable
Dec 01, 2017
07:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 01, 2017
07:23 AM
Has anyone found a solution/workaround to this problem?
Not applicable
Dec 06, 2017
02:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 06, 2017
02:20 AM
The problem was specific to the XMC4500 Relax Kit board. The VBUS signals from the main plug (X3) and the debug plug (X100) are connected to each other. This is shown in figure 4 in the Board Users Manual for the Relax Kit.
When the USB cable was removed from the X3 plug, VBUS would remain high as the X100 still supplied VBUS. This prevented the USB controller from detecting that the PC Host had stopped holding VBUS high and no GINTSTS.OTGInt interrupt were generated.
The solution was to remove the D2 diode connected to VBUS on the X3 plug. VBUS would then go low when connection to PC Host was lost, causing the GINTSTS.OTGInt interrupt to trigger as expected.
When the USB cable was removed from the X3 plug, VBUS would remain high as the X100 still supplied VBUS. This prevented the USB controller from detecting that the PC Host had stopped holding VBUS high and no GINTSTS.OTGInt interrupt were generated.
The solution was to remove the D2 diode connected to VBUS on the X3 plug. VBUS would then go low when connection to PC Host was lost, causing the GINTSTS.OTGInt interrupt to trigger as expected.