Multiple devices on different PHYs with USBX

TimTTP 40 Reputation points
2023-06-09T15:13:39.31+00:00

Hello,

I have an NXP chip with 2 USB PHYs (RT1170).

Using the demo code made available by NXP I have been able to run a COM port example which can run on one port at a time. However, I have struggled to find where USBX is binding to the physical port, which is preventing me from doing what I would like to be doing - running both ports at the same time.

Is this possible? This line in the USBX device stack User Guide suggests not:

Only one USB device controller can be defined at any time to operate in device mode. https://video2.skills-academy.com/en-us/azure/rtos/usbx/usbx-device-stack-2

Futhermore, if I want to run one port as USB host and one as USB device (they are both OTG ports) then how do I control which port is which? I presume this has to do with the ux_dcd_controller_initialize and ux_host_stack_class_register commands but I haven't seen this in any of the sample code or in the USBX manual.

Please advise!

Thanks,

Tim

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
331 questions
{count} votes

Accepted answer
  1. Chaoqiong Xiao 486 Reputation points Microsoft Employee
    2023-06-25T03:53:22.8366667+00:00
    1. About device controller, unfortunately two device port can not be supported at the same time (in USB spec. a device connected to two host tree is not defined).
    2. Feel free to run device on one port but host on other ports. In this case, the actual register base address is used (actually how ports are distinguished depends on the controller driver implement, but usually uses register base address to show difference).

    E.g.,

    in simulation example you can see both device and host run at the same time (https://github.com/azure-rtos/usbx/blob/master/samples/demo_usbx.c)

    1. Feel free to use https://video2.skills-academy.com/en-us/azure/rtos/usbx/usbx-host-stack-4#ux_host_stack_hcd_register to register multiple host controllers (if necessary). The initialization function and two parameters passed to HCD initialization function is used to differentiate controllers and/or drivers. Note If host ports are on single controller there is no need to register multiple controllers.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.