I have self-powered USB device running on FX2. Everything works except reconnection after USB cable is plugged out. When I plug-in the cable, device is not recognized on the host side and I have to power it down and up again to get it working.
I have implemented VBUS monitoring so device controls DISCONNECT bit. Except for that, what else should be done on the device side when "disconnected" and "connected" conditions are detected?
Is your firmware based on the firmware frameworks?
What other things are doing when disconnect is recognized using the VBUS monitoring?
Are you doing a software reset anywhere in your firmware? What is the VID/PID and the error code being shown in device manager when this unrecognized device error occurs?
Yes, firmware is based on the firmware framework. It's a composite device, comprising of one CDC device and one custom device that uses WinUSB driver. As I said, everything woks as supposed but when I unplug USB cable and reconnect it again it does not enumerate (VID&PID both appear to be 0x0000). I've programmed a LED to show connection status and disconnect state is detected as well as reconnected but then it hangs somewhere (not detecting if disconnected again). I've made VBUS detection according to application note and I manage DISCON bit accordingly. Any ideas?
When you say "not detecting if disconnected again" I assume the 2nd disconnect and anything after that is not detected. Please confirm.
If so, most probably your firmware is stuck somewhere due to the disconnect. Have you introduced any dependency in your code based on USB which can cause it to hang in a particular location?
Yes, you assumed correctly - 2nd and all subsequent reconnects fail. I've set-up debugger to try to locate the fault but it did not help. I placed a breakpoint to disconnect detection point and when hit, made software-reset (the best that can be done in Keil debugger) and still no enumeration. Seems like USB SIE got stuck somewhere and only hardware reset can pull it out. So, I wired an unused I/O port to reset line and it helped. Of course, I have to re-load firmware, but I don't need to power-down and up again. Nevertheless, I am curious how it should be done properly, if possible.
Did anyone managed to build self-powered device with FX2 chip? Any feedback is appreciated.