1 Reply Latest reply on May 4, 2011 5:31 AM by udayanu_

    USBUART reconnect

      I'm using the USBUART component from app note EP60246 but the question might also be valid for other USB interfaces.


      Everything works fine until the USB cable to the PC is unplugged. Now USBUART_bGetConfiguration() still reports a non-zero value. If I replug the PC and try to write to it USBUART_Write() fails to return.


      How can I detect the unplug and reconnect and reinitialize my USBUART component when possible?





        • 1. Re: USBUART reconnect
          • This can be done in two ways.
          • Method1:  A simple and easy way would be to monitor VBUS supply voltage. Place a Digital Input Pin on the TopDesign and connect it to the USB VBUS. Once you disconnect PSoC from PC there is no voltage on VBUS, the same can be used to ascertain device unplugged from host. Once VBUS power comes back, USB device can be re-enumerated again.
          • Method 2:  The USBFS component can be configured to bring out the SOF terminal which is the USB start of Frame signal. The same can be monitored and the inactivity on this terminal implies no host is connected.

          Let us know if one of these work.