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 am testing with a couple examples from the FX3 SDK (namely the usb HID Mouse example). I modified the code slightly so that it will continuously send mouse circles, but if I put the computer to sleep, or if I restart the computer the circles stop, and I have to press the gpio button again to re initiate the circles.

My question is what events need to be handled in order to properly handle a sleep or a restart on the host?

0 Likes
1 Solution

Hello,

When you restart the PC, the USB RESET event will be triggered. After this, the host requests for the descriptors  again. In the example project that you are testing currently, initially the value of glButtonPressed will be 1 after the button is pressed. But once the re-enumeration happens, the value of glButtonPressed goes to 0. This is because during enumeration the host sends a SET_IDLE request. Once this request is received the firmware resets the glButtonPressed to 0. This is the reason why you are not able to see the circles after restarting the PC.

After sending the SET_IDLE request, the host requests for the report descriptors from the device using GET_DESCRIPTOR request. Inside the handling of this request, you can set the value of glButtonPressed to 1 to re initiate the circles after restarting the PC. Please refer to the attached project to understand how this is implemented.

I have tested this project on my end and I was able to re initiate the circles after restarting the PC. Please let me know if you have any queries on this.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

4 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

According to my understanding, at the start you need to press the GPIO once. After this, the device will continuously send mouse circles. But, after a sleep or reset, the device will no longer send the mouse circles unless the GPIO is pressed again. Please correct me if Iam wrong.

Can you please share the modified firmware so that we can evaluate it at our end?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

Yes that's correct:
the code is exactly the example hid_examples/cyfx3_hid

with the following modification to "cyfx3_hid.c":

while (glButtonPress)

                {

                    /* Send Input Report */

                    status = CyFxHidSendReport ();

                    if (status == CY_U3P_SUCCESS)

                    {

                        //glButtonPress--;

                    }

                    else

                    {

                        CyU3PUsbStall (CY_FX_HID_EP_INTR_IN, CyTrue, CyFalse);

                    }

                }

(basically just comment out the glButtonPress decrement)

I'm using this example code to figure out what needs to be handled when the computer is put in sleep mode, or restarted. I have another codebase where the device stops functioning so I was hoping to shed some clarity by understanding with a simple example first. I cannot share the more complicated example on a public forum though because it's proprietary.

Hello,

When you restart the PC, the USB RESET event will be triggered. After this, the host requests for the descriptors  again. In the example project that you are testing currently, initially the value of glButtonPressed will be 1 after the button is pressed. But once the re-enumeration happens, the value of glButtonPressed goes to 0. This is because during enumeration the host sends a SET_IDLE request. Once this request is received the firmware resets the glButtonPressed to 0. This is the reason why you are not able to see the circles after restarting the PC.

After sending the SET_IDLE request, the host requests for the report descriptors from the device using GET_DESCRIPTOR request. Inside the handling of this request, you can set the value of glButtonPressed to 1 to re initiate the circles after restarting the PC. Please refer to the attached project to understand how this is implemented.

I have tested this project on my end and I was able to re initiate the circles after restarting the PC. Please let me know if you have any queries on this.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

Jayakrishna thank you very much. This solved my problem!