Does it possible to switch USB role actively on lpc1768?

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

Does it possible to switch USB role actively on lpc1768?

646 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cgha on Mon Nov 05 19:51:21 MST 2012
When on reset ,poll a special pin, for example, P1.5 ,if it is low initilize to device, otherwise, to host.
When on running, poll P1.5 to check if it should switch role, if need, just softwareReset.

Cgha
Labels (1)
0 Kudos
2 Replies

548 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxpUSBlib team on Mon Nov 12 11:07:04 MST 2012
The latest release of nxpUSBlib, v0.98, includes a new dual role example (Example_KeyboardHostDevice) which compiles in both the host and device stacks at the same time and provides a means to switch between the two on the fly via an external event.
This new example does not run the controller in OTG mode nor does it make use of the ID pin in the USB cable.
This new example is experimental, which in this case means it works but is not reasonably documented or tested.
0 Kudos

548 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Daniel Widyanto on Wed Nov 07 23:27:22 MST 2012
If you are thinking to implement similar USB OTG scheme, yes it's possible to switch the USB port role (host -> device, device -> host) on the fly.

In fact, this is the default implementation for USB OTG in LPC17xx. When USB cable ID pin is low, the OTG transceiver will interrupt the MCU, then the MCU is configuring itself for Host function (Refer to OTGStCtrl, PORT_FUNC bit, and restart the OHCI registers). Otherwise, the MCU will configure the port as USB device. See Fig 40 and Fig 41 UM10360 LPC17xx User Manual for the clarification.

If you don't use the OTG transceiver, then you need to figure out how to connect / disconnect the D+ pull up.






0 Kudos