Create some USB HID under PSoC 1 CY8C24894

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

cross mob
chzhc_4111666
Level 1
Level 1

Dear Mdm/Sir,

I was intending to Configure CY8C24894 as some generic data transfer between PC & this chip.

I try to configure USBFS as some HID device, with input/output report of 8 bytes each. The generated report descriptor is shown below.

USBFS_1_HID_REPORT_1_DESCR_START:                ;

    DB     06H, 00H, FFH                         ; Usage Page

    DB     09H, 01H                              ; Usage

    DB     A1H, 01H                              ; Collection

    DB     19H, 01H                              ; Usage Minimum

    DB     29H, 08H                              ; Usage Maximum

    DB     15H, 00H                              ; Logical Minimum

    DB     25H, FFH                              ; Logical Maximum

    DB     75H, 08H                              ; Report Size

    DB     95H, 08H                              ; Report Count

    DB     91H, 02H                              ; Output

    DB     19H, 01H                              ; Usage Minimum

    DB     29H, 08H                              ; Usage Maximum

    DB     15H, 00H                              ; Logical Minimum

    DB     25H, FFH                              ; Logical Maximum

    DB     75H, 08H                              ; Report Size

    DB     95H, 08H                              ; Report Count

    DB     81H, 02H                              ; Input

    DB     C0H                                   ; End Collection

USBFS_1_HID_REPORT_1_DESCR_END:                  ;

The simple firmware code is below

USBFS_1_Start(0, USB_5V_OPERATION);

while (USBFS_1_bGetConfiguration()==0x0); // Wait until it is configured.

USBFS_1_EnableOutEP(OUT_EP);

USBFS_1_LoadInEP(IN_EP, in_data_buf, NUM_BYTES, USB_TOGGLE); // Load & Enable

OFF_LED1;

OFF_LED2;

while (1)

{

     ON_LED1;

     if(USBFS_1_bGetEPAckState(OUT_EP))

     {

          ON_LED2;

          USBFS_1_bReadOutEP(OUT_EP, out_data_buf, NUM_BYTES);

          USBFS_1_LoadInEP(IN_EP, in_data_buf, NUM_BYTES, USB_TOGGLE); // Load & Enable

          USBFS_1_EnableOutEP(OUT_EP);

}

}

I only see LED1 is on, but LED2 is always off.

I am using the CyUSB.dll to do the report data sending.curHidDev.SetOutput(curHidReport.ID);

The returned value tells me the sending is correct.

Can you please help me where I am wrong?

Thanks & Regards,

Chao

0 Likes
3 Replies
SampathS_11
Moderator
Moderator
Moderator
250 sign-ins 250 solutions authored 5 questions asked

Hello Chao,

Instead of checking ack on the OUT_EP, can you try checking for ack on IN_EP?

if(USBFS_1_bGetEPAckState(IN_EP))

{

}

Best regards,

Sampath

0 Likes

Hi Sampath,

Thanks for the suggestion. I tried this IN_EP.

It seems to be true once a while. I did not do anything myself. Once device plug in, condition is true once a while.

The rate is very fast like a few hundred times per second.

You may help to explain?

Thanks again!

Chao

0 Likes

Hello Chao,

Do kindly let me know what you want to achieve with the code example. I am not sure of that,

Best regards,

Sampath

0 Likes