Combined USB UART and HID Keyboard

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

cross mob
lock attach
Attachments are accessible only for community members.
DoBa_1705086
Level 3
Level 3
First like received First like given

I want to configure the USBFS on a PSOC5 to simultaneously act as both a HID keyboard and as a USBUART (CDC) device.  I have succeeded at making both the USBUART and the HID Keyboard configurations work independently.  However, I cannot get both to work simultaneously.  My intent is to use the HID Keyboard interface to send keystroke data back to the UBS Host (PC or Mac) while the USBUART interface is used as a separate channel for application configuration and diagnostics.

I have attached a export of my most recent USB Descriptor root in xml format.  I have the necessary Interface Association Descriptor to link the CDC Comm & Data interfaces together.  A additional interface descriptor for the HID keyboard follows the USBUART entries.

I found a Cypress document that described a similar effort, but it was written before the PSOC Creator IDE could create Interface Association Descriptors - so it's rather outdated and didn't help me achieve the desired result.

What am I doing wrong to get both the USBUART and HID Keyboard to enumerate and operate simultaneously?

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

I have tried to make a composite device on my CY8CKIT-050 EVK.

1) Put a USBUART component on the CYSCH file to be used as the base component.

2) Remove the "Device Descriptor" node on the "Device Descriptor"

3) Import your XML file into the USBUART component.

4) Modified the descriptor.

4-1) Modify the "Device Descriptor" node as follows. The Device Class/Subclass must have EF/02 if an Interface Association Descriptor is used.

GS003314.png

4-2) Remove the Interface Association Descriptor for the HID interface.

GS003316.png

5) Write a simple code on main.c

#include "project.h"

int main (void) {

    CyGlobalIntEnable; /* Enable global interrupts. */

    /* Place your initialization/startup code here (e.g. MyInst_Start()) */

    USBUART_Start(0, USBUART_3V_OPERATION);

   

    for (;;) {

        /* Place your application code here. */

        while (USBUART_GetConfiguration() == 0);

       

        USBUART_IsConfigurationChanged();

       

        USBUART_CDC_Init();

       

        for (;;) {

            if (USBUART_IsConfigurationChanged()) {

                break;

            }

            USBUART_PutString("HELLO WORLD\r\n");

            CyDelay(2000);

        }

    }

}

The USBUART-RX and the HID are not used in this example.

6) Build and Program the Project and connect the PSoC 5LP to PC.

7) If a driver is required for the CDC device, use the INF file in the Generated_Source/PSoC5/USBUART directory.

Regards,

Noriaki

View solution in original post

0 Likes
3 Replies