I am having a weird problem with the MQXLITE+Processor Exprt USB stack. I have a device using the CDC stack to emulate a serial port. After reset, the device will connect fine with my host and show up as a serial port. But if I unplug the device and reconnect it again, it wont come back as a recongnized USB device any longer. I have been looking at the USB trace after the reconnect and the device seem to be failing sometime shortly after receving the initial GET_DESCRIPTOR(0) request. The device receives the setup packet correctly and responds with an ACK, but it does not respond to the subsequent IN tokens from the host. (During a successful enumeration, I see my device respond with a NACK packet on the first attempt from the host and then with a valid response. During the failed transfer, the device does not respond at all to the IN token).
To pinpoint the problem further I have run an experiment where I disable the D+ pullup shortly and then reenable it. The same problem occurs, the device disappears from the host and when it reappears again, the host tries to reenumerate the device but the enumeration fails during the GET_DESCRIPTOR call.
Has anyone seen something similar in the past? Any thoughts on where to start looking for the problem?
I have based my code on the virtual_com.c example code and the only initialization of the USB stack is the call to
error = USB_Class_CDC_Init(CONTROLLER_ID,USB_App_Callback, NULL,USB_Notify_Callback);
unless I have missed any initialization needed. (Which I doubt, given that the connection works the first time)
My hardware is a K20 MCU