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

USB superspeed peripherals Forum Discussions

DiDi_4439146
Level 3
Level 3
10 replies posted 10 questions asked 5 replies posted

I have a USB HID device that I want to wake up when the computer wakes up. How do I check when the computer wakes up? Is there an event produced? I can wake up the computer using CyU3PUsbDoRemoteWakeup, but I don't know how to wake up the device if something else wakes up the computer.

0 Likes
1 Solution

Hello,

Yes, you can make use of the event CY_U3P_USB_EVENT_RESUME on the device side to check if the host woke the device from suspend or not.

The API CyU3PEventGet () should be used for clearing the event flag. 

Please refer to the documentation of the API CyU3PEventGet and CyU3PEventSet in the FX3 API guide which provides details about these APIs.

The API CyU3PEventSet () has 3 parameters. The second parameter is just a bit mask that is used to select a flag of interest. It is not used for setting or clearing the flag, it just identifies the flag of concern. The 3rd parameter is used for providing set the kind of set operation to be performed. This parameter do not have a setting to clear any event flags.

The API CyU3PEventGet () has 5 parameters. Here also, the second parameter is  used to choose the flag of interest. But the 3rd parameter has settings to read and clear the flags. So, the API CyU3PEventGet () should be used to clear the event flag.

Best Regards,
Jayakrishna

View solution in original post

0 Likes
3 Replies
DiDi_4439146
Level 3
Level 3
10 replies posted 10 questions asked 5 replies posted

I think I figured out that it has to be done in the CY_U3P_USB_EVENT_RESUME callback event -- but I'm confused on how to clear my own event flag:

CyU3PEventSet(&event_group_init,
~EVENT_USB_SUSPENDED,
CYU3P_EVENT_AND);

I thought this would clear the "EVENT_USB_SUSPENDED" from the "event_group_init" event group, but it doesn't. I had to use:

CyU3PEventGet(&event_group_init,
EVENT_USB_SUSPENDED,
CYU3P_EVENT_AND_CLEAR,
&event_status,
CYU3P_NO_WAIT);

Can someone explain to me why Set doesn't let me clear the event, but Get does?

 

0 Likes

Hello,

Yes, you can make use of the event CY_U3P_USB_EVENT_RESUME on the device side to check if the host woke the device from suspend or not.

The API CyU3PEventGet () should be used for clearing the event flag. 

Please refer to the documentation of the API CyU3PEventGet and CyU3PEventSet in the FX3 API guide which provides details about these APIs.

The API CyU3PEventSet () has 3 parameters. The second parameter is just a bit mask that is used to select a flag of interest. It is not used for setting or clearing the flag, it just identifies the flag of concern. The 3rd parameter is used for providing set the kind of set operation to be performed. This parameter do not have a setting to clear any event flags.

The API CyU3PEventGet () has 5 parameters. Here also, the second parameter is  used to choose the flag of interest. But the 3rd parameter has settings to read and clear the flags. So, the API CyU3PEventGet () should be used to clear the event flag.

Best Regards,
Jayakrishna
0 Likes
DiDi_4439146
Level 3
Level 3
10 replies posted 10 questions asked 5 replies posted

I want to note, for anyone checking this topic in the future, that CY_U3P_USB_EVENT_SETCONF will be called after a DISCONNECT event, so you can use that during a restart.

0 Likes