AnsweredAssumed Answered

K70 USB CDC not working after unplug/replug of cable

Question asked by Terry Opie on Feb 18, 2019
Latest reply on Feb 25, 2019 by Daniel Chen

I apologize right now for not knowing enough about USB and its implementation in MQX on the K70.  This is an inherited project.  I'll try my best to provide as much information as I can and that I know.  I am learning how this works, but I'm at a point where I'm stuck and not sure where to go.

 

I have a K70 that has a full speed USB port.  The code is setting that port up as a USB CDC device.  I have communication working between the K70 and an Android device via an OTG cable.

 

I am noticing in certain instances where the communication stops or packets become "garbled" for lack of a better word.  I can see the data in the packets, but neither side of the communication really understands them. 

 

The biggest initiator of this scenario is when we unplug and then replug the USB cable.  I am assuming, maybe incorrectly, that this is something that I'd need to do the re-initialize the device driver once I've noticed a bus reset or re-enumeration complete event. 

 

Do I need to call USB_Class_CDC_Init() again?  Do I need to re-initialize the entire device driver?  Reset it somehow?  And if so, how?

 

I've been reading the MQX USB Device Reference manual and it just has a little snippet about how to use the CDC class layer API.  I've tried calling the USB_Class_CDC_Init() at different points, but nothing seems to work.  I've also tried to deinit the device before I reinit, but still no dice.

 

I'm stuck...  Any help would be greatly appreciate.  Like I said, I'm not sure what information I may be missing, so if there is something I left out that would help solve this, let me know and I'll provide the info.

 

Thanks in advance!!

Outcomes