USB suspend, resume and remote wakeup on CY8C24x94 and CY7C643xx parts? | Cypress Semiconductors
Support & Community
USB suspend, resume and remote wakeup on CY8C24x94 and CY7C643xx parts?
How to do a USB suspend, resume and remote wakeup on CY8C24x94 and CY7C643xx parts?
Remote Wakeup allows a suspended USB device to signal a host that may also be suspended. This notifies the host that it should resume from its suspended mode. A common USB device has the ability to support Remote Wakeup in a configuration descriptor. You would be able to find CY8C24x94 and CY7C643xx that can support Remote Wakeup when you are setting it Enable in the configuration descriptor of USB User Module Setup Wizard.
There is the USBFS_1_ADDR (the USB_CR0 register) register to control the USB resume and suspend . You can force write this bit to behave the way you want (USB suspend/resume) or create your own APIs to do this. USBFS_bRWUEnabled API function has already existed in the USBFS.ASM. A crude approach to this is mentioned below:
1. Monitor bus activity bit for a specific time, say 3ms. If no activity is detected start the suspend condition.
2. Enable interrupts.
3. Call the USB_Suspend API function or write a "0" to bit 7 of the USB_CR0 register. This disables USB transceiver, but maintains the USB address.
4. Write to the sleep bit of the CPU_SCR register. This powers down most of the PSoC systems including FLASH modules, internal main Oscillator and band gap. Care should be taken to disable/power down the analog blocks during the sleep condition.
5. 2 NOPs. These execute before any ISR and are pre-fetched by the processor.
6. Remaining code for exiting suspend routine.
You will get more information on this in the user module datasheet and the Technical Reference Manual of the part. If you plan to write the API for the suspend/resume then your code should be somewhat like the code given below:
AND REG[USBFS_1_ADDR], ~(USB_ADDR_ENABLE) ; Disable transceiver
RET ; Exit
OR REG[USBFS_1_ADDR], (USB_ADDR_ENABLE) ; Enable transceiver
RET ; Exit
We also have a CY4623 Mouse Reference Design based on our enCoreII product, you may review the firmware as a reference for the USB suspend, resume and remote wakeup of CY8C24x94 and CY7C643xx parts.