CY8CKIT_046 USB HID example problem

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

cross mob
JeHu_3414236
Level 5
Level 5
10 likes received First like received

I am trying to use the USB HID example and keyboard operation from the project CY8CKIT_046_USB_Mouse but I am having problems with the keyboard LED output report.  The HID report descriptor includes the LED output data but no OUT endpoint is configured in the interface descriptor.  Can somebody please update this project so I can see how to process EP OUT data?  Thank you.

This is where I downloaded the example:

http://www.cypress.com/file/418726/download

0 Likes
1 Solution
5 Replies
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received

Please check this AN, it will be helpful:

http://www.cypress.com/documentation/application-notes/an58726-usb-hid-intermediate-psoc-3-and-psoc-...

What specifically you are getting as problem with keyboard LED output report.

0 Likes

There seems to be many ways for checking if data is ready for endpoints.  In the USB datasheet it says:

Data write into the IN endpoint:

/* Check that IN endpoint buffer is empty before write data. */

if (USBFS_IN_BUFFER_EMPTY == USBFS_GetEPState(IN_EP))

{

/* Write data into IN endpoint buffer.

* Data is written after function returns and endpoint is available to be

* read by host.

*/

USBFS_LoadInEP(IN_EP, buffer, length);

}

Data read from OUT endpoint:

/* Check if OUT endpoint buffer contain data to be read. */

if (USBFS_OUT_BUFFER_FULL == USBFS_GetEPState(OUT_EP))

{

/* Read data from OUT endpoint buffer.

* Data is read after function returns and endpoint is available to be

* written by host.

*/

In the CY8CKIT_046_USB_Mouse example it says:

/* Send Keyboard data to PC, if there is an USB keyboard endpoint event pending */

if(USBFS_GetEPState(KEYBOARD_END_POINT) == USBFS_EVENT_PENDING)

{

USBFS_LoadInEP(KEYBOARD_END_POINT, (uint8 *)keyboardReport, KEY_RPT_SIZE);

usbDataSentFlag |= KEYBOARD_DATA_SENT;

}

In the AN58726 example it says:

/*Checks for ACK from host*/

if(USBFS_1_bGetEPAckState(1))

{

/*Function to Send Data to PC*/

In_EP();

/*Function to recieve data from PC*/

Out_EP();

}

Which is the correct check to determine if I can read/write to endpoints for HID keyboard?

0 Likes

You can use either of the method as depicted in  CY8CKIT_046_USB_Mouse Example Code or AN58726 .

Are you getting any issue in using the methods.

0 Likes

I'm trying to read data from OUT EP and I am having problems.  I am doing this in main loop:

            if (USBFS_OUT_BUFFER_FULL == USBFS_GetEPState(OUTPUT_END_POINT))

                USBFS_ReadOutEP(OUTPUT_END_POINT, buf, HID_RPT_SIZE);

I can only read the first OUT packet successfully and the second packet reads out random incorrect data.

0 Likes