Handling multiple cdc class usb devices from Host application in FreeRtos(in single task)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Handling multiple cdc class usb devices from Host application in FreeRtos(in single task)

1,959 Views
venkataddagatla
Contributor II

I would like to create a Host Application in FreeRTOS which supports the attachment of Multiple CDC class Devices connected through the USB HU

There is an example (e.g. the HID mouse example and mouse+keyboard examples)I have gone through it but it seems that it works with a device connected via HUB, but the examples only support one device instance within each class (separate mouse and keyboard tasks).

If I would like to create an only a single thread to handle Multiple CDC class USB devices. What and all the modifications are required in the USB protocol stack.? 

Is it possible to design an application to support multiple devices of the same class?

Do you have any example projects?

Labels (1)
0 Kudos
Reply
6 Replies

1,788 Views
Mincho
Contributor I

Hello @venkataddagatla,

Any luck for the multiple CDC devices support on the Host side?

I have the same question. I'm working on a USB host application based on RT1052, with 4 CDC devices connected simultaneously (via a USB hub).

I followed the USB Host HID Mouse & Keyboard example, however, still can only get the first CDC device started.

Thanks,

Alex

0 Kudos
Reply

1,931 Views
venkataddagatla
Contributor II

Thanks for the reply.

Actually i was asked about the same class device handling at Host application . As i am using FREERTOS at host application and i want to connect multiple CDC class USB devices to the Host via USB HUB on one USB host port.

I was looking the sample code "evkmimxrt1170_host_hid_mouse_keyboard_freertos_cm7" here, 2 different USB class devices are being used and 2 tasks are created to handle Mouse and Keyboard.

/**Snippet***/

int main(void)
{

USB_HostApplicationInit();

if (xTaskCreate(USB_HostTask, "usb host task", 2000L / sizeof(portSTACK_TYPE), g_HostHandle, 4, NULL) != pdPASS)
{
usb_echo("create host task error\r\n");
}
if (xTaskCreate(USB_HostApplicationMouseTask, "mouse task", 2000L / sizeof(portSTACK_TYPE), &g_HostHidMouse, 3,
NULL) != pdPASS)
{
usb_echo("create mouse task error\r\n");
}
if (xTaskCreate(USB_HostApplicationKeyboardTask, "keyboard task", 2000L / sizeof(portSTACK_TYPE),
&g_HostHidKeyboard, 3, NULL) != pdPASS)
{
usb_echo("create mouse task error\r\n");
}

vTaskStartScheduler();

while (1)
{
;
}
}

*********************

 

My question is if i want to connect multiple HID_Mouse USB device to Host, how that can be handled in the single thread. And how the differentiation will be done with other same class of USB device( like HIB_Mouse). 

0 Kudos
Reply

1,927 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @venkataddagatla ,

There isn't such example. But I think this is no problem. Because each CDC device has a instance. In a thread, you can polling each instance.

 

Regards,

Jing

0 Kudos
Reply

1,893 Views
venkataddagatla
Contributor II

But it is difficult to maintain the CDC instance for each USB device because we can not able to identify on what address the USB devices are registered.

If we want to poll the no of USB CDC devices in single thread, how we can identify the device address to poll each.

for example 

i have 4 displays and 4 keypads connected to the USB CDC host.

How i can poll separately because we are not sure on which address the display and keypads will register.

0 Kudos
Reply

1,866 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @venkataddagatla ,

There isn't multi CDC host example, but there is a host_hid_mouse_dual example in SDK. The way to deal with multi device is same. You can refer to it.

 

Regards,

Jing

0 Kudos
Reply

1,943 Views
jingpan
NXP TechSupport
NXP TechSupport
0 Kudos
Reply