I looked through the NXP documentation to try to find what would be necessary to switch port 1 from device to host mode. I found the info on the USB_nUSBMODE register for setting the mode. However, this code for USBHost_t36's ehci.cpp makes it look like the code changes to support two ports would not be trivial:
Code:
if (stat & USBHS_USBSTS_TI0) { // timer 0 - used for built-in port events
//println("timer0");
if (port_state == PORT_STATE_DEBOUNCE) {
port_state = PORT_STATE_RESET;
// Since we have only 1 port, no other device can
// be in reset or enumeration. If multiple ports
// are ever supported, we would need to remain in
// debounce if any other port was resetting or
// enumerating a device.
USBHS_PORTSC1 |= USBHS_PORTSC_PR; // begin reset sequence
println(" begin reset");
} else if (port_state == PORT_STATE_RECOVERY) {
port_state = PORT_STATE_ACTIVE;
println(" end recovery");
// HCSPARAMS TTCTRL page 1671
uint32_t speed = (USBHS_PORTSC1 >> 26) & 3;
rootdev = new_Device(speed, 0, 0);
}
}
I really don't know enough about USB to make deep changes to USBHost_t36. I'm sure I will miss something like this, and would have no idea how to debug the problem.
I guess I'll just submit this as a feature request then, for a future version of USBHost_t36: since both supported USB ports are OTG-capable, it would be great if both could be operated as host ports. Thanks!
For now I guess I'll have to use a second hub board to get two host ports.