I.MX RT 1064 ISSUE WITH COMPOSITE HOST

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I.MX RT 1064 ISSUE WITH COMPOSITE HOST

1,691件の閲覧回数
Avillalba
Contributor III

I have used MCUXSDKUSBSHOSTCOMPUG to initiate a composite host that supports CDC and HID devices. This works individually but when I run them through a hub I see the following errors:

CDC first then HID.PNGHID first then CDC.PNG 

From the document it seems this should be enough to support both devices at the same time but it doesn't seem this way, is there something else I need to implement for the hub to support both devices at the same time?

ラベル(1)
0 件の賞賛
返信
10 返答(返信)

1,673件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @Avillalba .

 

Is it possible to share the related code snippet for a review? For example, USB_HostEvent(), and I am also wondering if you built this application based on the host cdc demo, please kindly clarify.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信

1,670件の閲覧回数
Avillalba
Contributor III

hi @Kan_Li I built this application using the stand alone host CDC demo and the HID mouse/keyboard demo. Here is the code i am using for USB_HostEvent():

usb_status_t USB_CompHostEvent(usb_device_handle deviceHandle,
                               usb_host_configuration_handle configurationHandle,
   uint32_t eventCode)
{
usb_status_t hidStat;
usb_status_t cdcStat;
usb_status_t status = kStatus_USB_Success;
    switch(eventCode & 0x0000FFFFU){
    case kUSB_HostEventAttach:
          cdcStat = USB_HostCdcEvent(deviceHandle, configurationHandle, eventCode);
          hidStat = USB_HostHidMouseEvent(deviceHandle, configurationHandle, eventCode);
          if ((cdcStat == kStatus_USB_NotSupported) && (hidStat == kStatus_USB_NotSupported))
                  {
                          status = kStatus_USB_NotSupported;
                  }
          break;
    case kUSB_HostEventNotSupported:
          usb_echo("device not supported.\r\n");
          break;
    case kUSB_HostEventEnumerationDone:
          cdcStat = USB_HostCdcEvent(deviceHandle, configurationHandle, eventCode);
          hidStat = USB_HostHidMouseEvent(deviceHandle, configurationHandle, eventCode);
          if ((cdcStat != kStatus_USB_Success) && (hidStat != kStatus_USB_Success))
          {
                  status = kStatus_USB_Error;
          }
          break;
    case kUSB_HostEventDetach:
          cdcStat = USB_HostCdcEvent(deviceHandle, configurationHandle, eventCode);
          hidStat = USB_HostHidMouseEvent(deviceHandle, configurationHandle, eventCode);
          if ((cdcStat != kStatus_USB_Success) && (hidStat != kStatus_USB_Success))
                  {
                  status = kStatus_USB_Error;
                  }
          break;
    case kUSB_HostEventEnumerationFail:
          usb_echo("enumeration failed\r\n");
          break;
    default:
          break;
          }
return status;

 

I also ran into an issue at first where disconnecting the mouse would disconnect the CDC device so I added this section of code to the USB_HostCdcEvent() function:

case kUSB_HostEventDetach:
          if (g_cdc.deviceHandle == deviceHandle)
          {
                  if (g_cdc.deviceState != kStatus_DEV_Idle)
                  {
                          g_cdc.deviceState = kStatus_DEV_Detached;
                          g_AttachFlag = 0;
                          USB_HostCdcInitBuffer();
                  }
          }

          break;

0 件の賞賛
返信

1,611件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @Avillalba ,

 

I just implement a host composite cdc hid keyboard & mouse demo based on the user guide, looks like it works well on my side. Please kindly refer to the following for details.

host init done
This example requires that the CDC device uses Hardware flow
if the device does't support it, please set USB_HOST_UART_SUPPORT_HW_FLOW to zero and rebuild this project
Type strings, then the string
will be echoed back from the device
hub attached:level=1 address=1
device cdc attached:
pid=0x94vid=0x1fc9 address=2
cdc device attached
get serial state value = 3
hid mouse attached:pid=0x301avid=0x413c address=3
mouse attached
hid keyboard attached:pid=0x2107vid=0x413c address=4
keyboard attached
ggghjujjj

but the hub on my hands is very old with some connection issue, so the demo doesn't run very stable on my side, and I am concerning the hub power, so maybe you can use a hub with external power supply and try again?

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信

1,601件の閲覧回数
Avillalba
Contributor III

hi @Kan_Li are you able to provide your source code as I may be missing something when trying to implement on my own, you verified this works when a single host port is connected to a hub and the mouse, keyboard, and cdc device are all connected to the hub?

0 件の賞賛
返信

1,588件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @Avillalba ,

 

Please kindly refer to the attachment for details. Please kindly let me know if there is any issue.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信

1,574件の閲覧回数
Avillalba
Contributor III

hi @Kan_Li I must be missing some configuration, I have tried running your provided code and it shows the same issue with the HID mouse and CDC device as I had initially. I have a secondary 1064EVK which I am running the evkmimxrt1064_dev_cdc_vcom_bm example and on the other EVK I have the example which you linked to me. Depending on the order I connect the devices I see either 

pid=0x94vid=0x1fc9 address=3

cdc device attached

data transfer error = 0 , status

set data interface error

or 

hid mouse attached:pid=0x939vid=0x4f2 address=3

mouse attached

set interface error

Error in USB_HostHidRecv

 

Can you confirm the hardware you are using to test the source code? 

0 件の賞賛
返信

1,528件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @Avillalba ,

 

Yes, we are almost the same, I am using RT1060EVK as USB Device CDC, and mouse and keyboard are also the generic type.

 

Best Regards,

Kan

0 件の賞賛
返信

1,519件の閲覧回数
Avillalba
Contributor III

hi @Kan_Li i cant seem to run your example out of the box, i had to switch the "CONTROLLER_ID" variable from kUSB_ControllerEhci0 to kUSB_ControllerEhci1. Running the demo you provided with CONTROLLER_ID set to kUSB_ControllerEhci0 causes the hub to not get powered and no devices get seen but when i switch to kUSB_ControllerEhci1 my usb hub gets power but then repeats the same behavior from before. Can you confirm which version of MCUXpresso you are as using as well as which SDK version you are using? I am using MCUXpresso IDE v11.8.0_1165 and sdk_2_14_0_evk-mimxrt1064

0 件の賞賛
返信

1,510件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @Avillalba ,

 

Please kindly refer to the following for details.

Kan_Li_0-1716367749937.png

Kan_Li_1-1716367802550.png

 

Maybe you can update the IDE as well as the sdk to the latest version and try again.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信

1,490件の閲覧回数
Avillalba
Contributor III

hi @Kan_Li I updated to SDK version 2.15 and MCUXpresso IDE v11.9.1 [Build 2170] [2024-04-19] and I ran your demo again but it still produced the same errors as before. I still had to change the ControllerID to EHCI1 as ECHI0 does not power the USB hub.

If mouse is attached first I see the following: 

hub attached:level=1 address=1

hid mouse attached:pid=0x939vid=0x4f2 address=2

mouse attached

device cdc attached:

pid=0x94vid=0x1fc9 address=3

cdc device attached

data transfer error = 0 , status

set data interface error

 

IF CDC attaches first I see the following:

device cdc attached:

pid=0x94vid=0x1fc9 address=2

cdc device attached

get serial state value = 3

not idle cdc instance

hid mouse attached:pid=0x939vid=0x4f2 address=3

mouse attached

set interface error

Error in USB_HostHidRecv

0 件の賞賛
返信