Showing results for 
Search instead for 
Did you mean: 

Knowledge Base Articles

USBFS Suspend and Resume Functionality - KBA210675

Not applicable

USBFS Suspend and Resume Functionality - KBA210675

Version: **

Translation - Japanese: USBFS の サスペンド (Suspend) と レジューム (Resume) 機能 - KBA210675 - Community Translated (JA)


How do we implement Suspend-Resume functionality in USBFS?


A USB device will enter suspend when there is no activity on the bus for greater than 3 ms. It then has a further 7 ms to shut down the device and draw no more than the designated suspend current. This means that the device must be drawing only the rated suspend current from the bus 10 ms after bus activity stopped.

The following piece of code shows how to implement Suspend-Resume functionality in USBFS.

                 if(noActivityCount == USB_SUSPEND_TIME_TICKS)
                     PSOC_APP_LED_Write(1);       // To check if the device has entered Suspend.
                     CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_PICU); /* PSoC 3/5LP enters sleep mode */
                     init =1;                                // To initialize the endpoints again - Note 1.
                     noActivityCount = 0;
                     PSOC_APP_LED_Write(0);      // To view the status on a LED.
                 noActivityCount = 0;

Note 1: After the device wakes up, the endpoints have to be enabled again; if it is in Mode 3/2, you need to configure the DMAs again.
Note 2: The code snippet is written assuming that the USBFS Component is named as "USBFS".

Algorithm followed:

The firmware checks the status of the USB activity; if it is found to be inactive for 3 ms,it understands that a Suspend has been issued. Keep the USB_SUSPEND_TIME_TICKS value appropriately so that the firmware waits for minimum of 3 ms. A typical value will be 500 when the firmware has no or minimal delay in the firmware. The firmware then goes to low-power Sleep mode.

If a resume is issued, it wakes up by the port interrupt control unit (PICU) interrupt and then reconfigures the USBFS Component and initializes the endpoints again (to be done in the firmware by checking status of the init variable).

Version history
Revision #:
1 of 1
Last update:
‎Apr 07, 2016 04:02 AM
Updated by: