# USB OTG / device

**URL:** https://community.solid-run.com/t/usb-otg-device/778
**Category:** NXP LX2160
**Created:** [November 29, 2023, 11:12am UTC](https://community.solid-run.com/t/usb-otg-device/778 "2023-11-29T11:12:44Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![joema](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@joema](https://community.solid-run.com/u/joema)
#### Post date: [November 29, 2023, 11:12am UTC](https://community.solid-run.com/t/usb-otg-device/778/1 "2023-11-29T11:12:44Z")

</div>

fsl-lx2160a.dtsi has the default “host” in dr\_mode of both usb0 and usb1.

can we use either otg or device modes with either usb0 or usb1?

do we just change the dr\_mode field to “device” or “otg” and that’s it, or is anything else needed?

if we choose otg - do we have to make sure we use a USB cable where the fifth ID pin is grounded on one end and floating on the other end?

can we try these otg/device modes with the Clearfrog CX board? it has two usb A ports - we assume each port is connected to each of the USB controllers of the lx2160

thanks!

---

<div class="post-metadata">

### Author: ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)
#### Post date: [December 1, 2023, 2:14am UTC](https://community.solid-run.com/t/usb-otg-device/778/2 "2023-12-01T02:14:56Z")

</div>

You can only use the bottom rear port as an device port as the other ports go through USB hubs so device mode isn’t possible. Just changing the dr\_mode should be enough. You should not need a special USB cable since the board only has type A connectors so there is no OTG detection possible. The configuration will need to be done manually through the Linux usb gadget interface. Basically the difference from a software perspective is that in OTG mode the controller can be switched between host and device mode via the kernel controls, if you choose device-mode then the port will only be able to run as a USB target.

---

<div class="post-metadata">

### Author: ![joema](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@joema](https://community.solid-run.com/u/joema)
#### Post date: [December 3, 2023, 8:32am UTC](https://community.solid-run.com/t/usb-otg-device/778/3 "2023-12-03T08:32:07Z")

</div>

There are two USB type A connectors on the ClearFrog CX - I think the top is usb0 and the bottom is usb1 (both of which are defined in fsl-lx2160a.dtsi). Do you mean one of those ports can be used as a device port? or something else? I don’t see any other port, except the two micro ports which are the console and the stm32.

---

<div class="post-metadata">

### Author: ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)
#### Post date: [December 4, 2023, 5:33am UTC](https://community.solid-run.com/t/usb-otg-device/778/4 "2023-12-04T05:33:34Z")

</div>

Yes only the bottom USB-A connector can be used in device mode. It will require a USB-A to USB-C cable to a USB-C port, or that same cable with a USB-C female to USB-A adapter to plug into a standard USB-A port

---

<div class="post-metadata">

### Author: ![joema](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@joema](https://community.solid-run.com/u/joema)
#### Post date: [December 4, 2023, 11:13am UTC](https://community.solid-run.com/t/usb-otg-device/778/5 "2023-12-04T11:13:34Z")

</div>

Thanks! And just to be sure - that bottom USB-A connector correlates with “usb1”, the 2nd entry in fsl-lx2160a.dtsi?

---

<div class="post-metadata">

### Author: ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)
#### Post date: [December 8, 2023, 8:41am UTC](https://community.solid-run.com/t/usb-otg-device/778/6 "2023-12-08T08:41:59Z")

</div>

The bottom port correlates to usb0, usb1 is connected to the onboard hubs on the CEX7 module.

---

<div class="post-metadata">

### Author: ![joema](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@joema](https://community.solid-run.com/u/joema)
#### Post date: [December 9, 2023, 8:04am UTC](https://community.solid-run.com/t/usb-otg-device/778/7 "2023-12-09T08:04:54Z")

</div>

Thank you!
