Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
USB suspend, resume and remote wakeup on CY8C24x94 and CY7C643xx parts?
Question: 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:
For Suspend: .SECTION USB_Suspend: _USB_Suspend: AND REG[USBFS_1_ADDR], ~(USB_ADDR_ENABLE) ; Disable transceiver RET ; Exit .ENDSECTION
For Resume: .SECTION USB_Resume: _USB_Resume: OR REG[USBFS_1_ADDR], (USB_ADDR_ENABLE) ; Enable transceiver RET ; Exit .ENDSECTION
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.