USB Suspend, Resume, and Remote Wake-Up Operations with Full Speed USB (USBFS) User Module - KBA86942

Version: **

 

Question: What are USB suspend, resume, and remote wake-up operations and how are they achieved with enCoRe™ V devices?

 

Answer:

In the USB suspend operation, the host drives the USB device into sleep. Similarly, in the USB resume operation, the host wakes up the USB device. In the remote wake-up operation, the USB device wakes up the host, which is in sleep mode.

USB Remote Wake-Up:

The remote wake-up can be demonstrated with the help of a switch connected to the GPIO. Once connected to a PC host, the USB device enumerates as a HID-compliant device (if the USBFS component within it is configured properly). First, put the host computer to sleep. Then, after it is asleep, press the switch connected to the PORT pin. This will wake up the host and resume the USB operation. This can be achieved using code similar to that shown below:

if( (PRT2DR | 0xF7) != 0xFF ) // check if switch connected to P2_3 is pressed { USBFS_Force(USB_FORCE_K); // force K-state in the USB Bus D+ and        D- lines to wake-up from sleep USBIO_CR0&=0x7F; // enable the USB}

USB Suspend and Resume:

USB suspend and resume can be demonstrated with the help of a switch connected to the GPIO. Once connected to a PC host, the USB device enumerates as a HID-compliant device (if the USBFS component within it is configured properly). When you press the switch connected to the PORT pin, the USB operation will be forced to suspend and resume after some set delay. This can be achieved using code similar to that shown below:

unsigned char bUsbActive;if( (PRT2DR | 0xF7) != 0xFF ) // check if switch connected to P2_3 is pressedfor(k=0;k<65535;k++);  USB_CR0&=0x00; // forced suspend do {   PRT1DR=0x01;   // Check for USB Activity  bUsbActive = USBFS_bCheckActivity();  } while( bUsbActive == 0x00 );  USB_CR0|=0x80; // forced resume}