USB disconnect not detected

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB disconnect not detected

1,124 Views
Frelon
Contributor I
Hi,
I use a MCF52210 for a USB application. My program works fine except when I remove the USB key, it is not detected.
For that, I use the following code to detect the removal (detect a reset):
if(MCF_USB_INT_STAT & MCF_USB_INT_STAT_USB_RST)
{
   ...
   // Remove the reset condition
   MCF_USB_INT_STAT = MCF_USB_INT_STAT_USB_RST | MCF_USB_INT_STAT_ATTACH;
   ...
}
 
I enable USB interrupts at initialisation like that:
MCF_USB_INT_ENB = MCF_USB_INT_ENB_SLEEP | MCF_USB_INT_ENB_TOK_DNE
                    | MCF_USB_INT_ENB_ERROR | MCF_USB_INT_ENB_USB_RST
                    | MCF_USB_INT_ENB_STALL;
 
Is there something wrong with that code ?
 
Frelon
Labels (1)
0 Kudos
1 Reply

282 Views
RichTestardi
Senior Contributor II
Hi,
 
If you're talking to a USB key, does that mean you're in host mode?  It looks like the case since you are catching an attach interrupt...
 
Can you actually *detect* a reset in host mode?  (I thought you generated the reset in host mode.)
 
I think you can just detect a problem when the device goes away, and then (re)arm for the subsequent (re)attach.
 
At least that is what I did in my host mode driver...  (In my device mode driver, otoh, I detected a reset.)
 
-- Rich
 
0 Kudos