USB data transmission receiption

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

cross mob
BhSa_4078721
Level 2
Level 2
10 replies posted 10 questions asked 5 replies posted

I have developed the USB HID keyboard application.. But unable to receive the data send from computer to keyboard... i.e to turn on/off command for CAPSLOCK/NUMLOCK/SCROLLLOCK led...

Can i get any reference or specific file or routine where i can receive that data & turn on or off leds accordingly...... 

0 Likes
5 Replies
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi BhSa_4078721​,

Can you please let us know which device and IDE are you using?

Also, we have HID code examples, which you can refer to get a more clear understanding. You can refer this 3-button HID mouse code example here : https://www.cypress.com/documentation/code-examples/ce226423-psoc-6-mcu-usb-hid-mouse-application​. This code example demonstrates how to setup a USB HID descriptor to implement a 3-button mouse.

Also, you can refer this application note : https://www.cypress.com/documentation/application-notes/an57473-usb-hid-basics-psoc-3-and-psoc-5lp​.  There is a code example which demonstrated USB HID mouse implementation : https://www.cypress.com/documentation/code-examples/ce95394-usb-hid-mouse-psoc-35lp .

Please let us know in case of further queries.

Best Regards,

Aashita

0 Likes

I am using CY8C4246AZI-L445....IDE Psoc4....

The mentioned link is for mouse...i want to create for keyboard.

I have already developed the usb keyboard code....its working fine.....

i want to control the capslock/numlock/scrolllock leds....

I have also added the OUT endpoint in sch component and written the below code to turn on leds

/* Check to see if the OUT Endpoint is full from a recieved transaction. */

        if(USBFS_1_GetEPState(OUT_ENDPOINT) == USBFS_1_OUT_BUFFER_FULL)

        {

            CAP_Write(1);      // capslock led...written only for testing purpose

           

            /* Get the number of bytes recieved */

            OUT_COUNT = USBFS_1_GetEPCount(OUT_ENDPOINT);

            /* Read the OUT endpoint and store data in OUT_Data_Buffer */

            USBFS_1_ReadOutEP(OUT_ENDPOINT, USB_Out_Keyboard_Data, OUT_COUNT);

            /* Re-enable OUT endpoint */

            USBFS_1_EnableOutEP(OUT_ENDPOINT);

        }

but still i didnt get positive result..

0 Likes

Hi BhSa_4078721​,

Can you please check the section "APPENDIX C: USB KEYBOARD IMPLEMENTATION" in the USB HID spec provided on the USB-IF here : Device Class Definition for HID 1.11 | USB-IF ?

After going through the code mentioned by you, the flow of the firmware seems to be correct. Can you please check the REPORT_DESCRIPTOR as provided in the USB-HID spec?

Best Regards,

Aashita

0 Likes

Hi,

I have checked the APPENDIX C and also REPORT Descriptor for keyboard...I have compare it with my report descriptor...there are minor difference in input & output field...but how to edit that?

I have attached my report descriptor.

0 Likes

0 Likes