USB Controller ID kUSB_ControllerEhci1

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

USB Controller ID kUSB_ControllerEhci1

Jump to solution
1,340 Views
vonp
Contributor II

Hi all,

I am trying to use the USB as a device on port J10 instead of J9 on the MXRT1064-evk. I am using the dev_cdc_vcom_lite_bm example in SDK_2.4.1_EVK-MIMXRT1064 and IAR. I did find this post from a while ago https://community.nxp.com/thread/492145, but I am not having any luck. In virtual_com.h I have changed:

#define CONTROLLER_ID kUSB_ControllerEhci0

to 

#define CONTROLLER_ID kUSB_ControllerEhci1

What else needs to be done to change the device id?

Labels (2)
0 Kudos
1 Solution
1,127 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Heath Pritchett

Currently, there are no platforms which have two EHCI IPs, so, when you defined kUSB_ControllerEhci1 it gives an error as "ControllerNotFound". RT1050 already uses SDK v2.5 (while RT1064 uses 2.4.1) and it has implemented differently the usb_ehci driver, so you can tell the driver to use the USBOTG2 with the software of the EHCI device.

Until the SDK driver is updated to 2.5, as a workaround you could use the following code in the usb/device/source/ehci/usb_device_ehci.c file.

...............

  if ((controllerId < kUSB_ControllerEhci0) ||
      //  ((uint32_t)(controllerId - kUSB_ControllerEhci0) >= USB_DEVICE_CONFIG_EHCI) ||
        ((uint32_t)(controllerId - kUSB_ControllerEhci0) >= (sizeof(ehci_base) / sizeof(uint32_t))))
    {
        return kStatus_USB_ControllerNotFound;
    }

    ehciState = &g_UsbDeviceEhciSate[controllerId - kUSB_ControllerEhci0 - 1];

    ehciState->dtd = s_UsbDeviceEhciDtd[controllerId - kUSB_ControllerEhci0 -1 ];
    ehciState->qh = (usb_device_ehci_qh_struct_t *)&qh_buffer[(controllerId - kUSB_ControllerEhci0 - 1) * 2048];

    ehciState->controllerId = controllerId;


.................

Hope this helps
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

-------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
1,128 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Heath Pritchett

Currently, there are no platforms which have two EHCI IPs, so, when you defined kUSB_ControllerEhci1 it gives an error as "ControllerNotFound". RT1050 already uses SDK v2.5 (while RT1064 uses 2.4.1) and it has implemented differently the usb_ehci driver, so you can tell the driver to use the USBOTG2 with the software of the EHCI device.

Until the SDK driver is updated to 2.5, as a workaround you could use the following code in the usb/device/source/ehci/usb_device_ehci.c file.

...............

  if ((controllerId < kUSB_ControllerEhci0) ||
      //  ((uint32_t)(controllerId - kUSB_ControllerEhci0) >= USB_DEVICE_CONFIG_EHCI) ||
        ((uint32_t)(controllerId - kUSB_ControllerEhci0) >= (sizeof(ehci_base) / sizeof(uint32_t))))
    {
        return kStatus_USB_ControllerNotFound;
    }

    ehciState = &g_UsbDeviceEhciSate[controllerId - kUSB_ControllerEhci0 - 1];

    ehciState->dtd = s_UsbDeviceEhciDtd[controllerId - kUSB_ControllerEhci0 -1 ];
    ehciState->qh = (usb_device_ehci_qh_struct_t *)&qh_buffer[(controllerId - kUSB_ControllerEhci0 - 1) * 2048];

    ehciState->controllerId = controllerId;


.................

Hope this helps
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

-------------------------------------------------------------------------------

0 Kudos