Renumeration Bit on USB Cable Disconnect

Question: How do we set the renumeration bit to enable DEFAULT USB Device the next time USB is reconnected? In which ISR is this command placed?



In the frameworks source file fw.c, you will notice a section where the EZUSB_Discon() routine is invoked, from discon.c (C:\Cypress\USB\Target\Lib\LP\), is made. In this routine, bit 1 (RENUM) of USBCS register is set to 1. If you do not want the 8051 to respond to the host with the device specific descriptors, you need to set this RENUM bit to zero. So, when the firmware renumerates on a reconnect, the device will use the default descriptors.

To be compliant with the USB spec, a self-powered device needs to monitor VBUS at the USB connector. It should not apply the pull-up on D+ before VBUS is present, and must remove the pull-up on D+ when VBUS is removed. Not doing any of these results in a back voltage. Typically, VBUS is monitored by using an I/O pin. Connect a 100 KOhm resistor between the I/O pin used to sense VBUS and GND, and a 22 KOhm resistor between VBUS and the I/O pin.

The firmware must continuously monitor the state of VBUS. When VBUS is present, the firmware should connect itself to the USB bus by clearing the DISCON bit in the USBCS register. This controls the pull-up on the D+ line which signals a connnection to the host. When VBUS is removed, the firmware should set the DISCON bit in the USBCS register, thus removing the pull-up on D+.