How to use the Suspend() in the Cypress CyAPI

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
vizhc_1647976
Level 1
Level 1

Hi,

   

I'm developing the USB application with the CYUSB3KIT-003 SUPERSPEED EXPLORER KIT. I call the Suspend() function in my host software. In the host side, the Suspend() returns true, but there's no corresponding action in the device side. Would somebody explain the function or usage of the Suspend() for me?

   

Thanks.

0 Likes
5 Replies
Anonymous
Not applicable

When host sends a suspend request, the device needs to handle it.  I do not see your firmware, so I cannot say how you are handling it. 

   

If you download FX3 SDK, we have provided a "LowPowerTest" example. This example shows the correct way to suspend the device. Please check with this firmware, we expect it to work fine. Once you have tested, you can use this as a base for your project to implement suspend request from the host. 

   

EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxlowpowertest

0 Likes
lock attach
Attachments are accessible only for community members.
vizhc_1647976
Level 1
Level 1

Hi Nishant,

   

I test the sample code SDK\1.3\firmware\basic_examples\cyfxlowpowertest.

   

There are two main variables in the sample code.

   

1)glSuspendEnbl : set to CyTrue by the vendor command, CY_FX_LP_VBUS_SUSPEND_RQT or CY_FX_LP_USB_SUSPEND_RQT, 

   

2)glTriggerSuspend : set to CyTrue by USB suspend event, CY_U3P_USB_EVENT_SUSPEND

   

Once the both variables are set to CyTrue, the suspend flow in the main loop will be executed. I can set the glSuspendEnbl to CyTrue, but I don't know how to set glTriggerSuspend to CyTrue by CY_U3P_USB_EVENT_SUSPEND event. I have tried the Suspend() api in the host software, and it didn't cause corresponding action in the device side.

   

The attach file is my test code which I only add some debug log to original sample code.

0 Likes
vizhc_1647976
Level 1
Level 1

I notice that \EZ-USB FX3 SDK\1.3\driver\CyUSB.pdf, and it says IOCTL_ADAPT_SET_DEVICE_POWER_STATE is no longer supported. I think the Suspend() function in the CyAPI is based on this IOCTL, so the function Suspend() has no function. Is that right?
 

0 Likes
Anonymous
Not applicable

You can set this in the CyFxApplnUSBSetupCB where we have handled vendor commands. we are setting glTriggerSuspend while handling the vendor command to suspend the device. You can also have a similar implementation. You will need to send that particular vendor command, in order to move the device to suspend.

0 Likes
vizhc_1647976
Level 1
Level 1

Ok, I know that the Suspend() function in the CyAPI doesn't work. I'll try you mentioned method. Thanks. 

0 Likes