Personal tools

1-1-1-1-3-1-21

From ICOP tech wiki

Revision as of 11:26, 6 March 2020 by Viky6 (talk | contribs) (Created page with " <div id="column-content"> <div id="content"> <a id="top"></a> <h1 id="firstHeading" class="firstHeading">DART-MX8M USB OTG</h1> <div id="bodyContent">...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<a id="top"></a>

DART-MX8M USB OTG

From Variscite Wiki

Jump to: <a href="#column-one">navigation</a>, <a href="#searchInput">search</a>


DART-MX8M-MINI USB OTG


Contents

  • <a href="#Configuring_the_USB_OTG_port_under_Linux">1 Configuring the USB OTG port under Linux</a>
  • <a href="#Using_the_USB_OTG_port_under_Linux">2 Using the USB OTG port under Linux</a>
    • <a href="#As_host_.28default.29">2.1 As host (default)</a>
    • <a href="#As_peripheral">2.2 As peripheral</a>
    • <a href="#As_OTG">2.3 As OTG</a>

1 Configuring the USB OTG port under Linux

By default, the USB OTG port is configured as OTG in the device tree, and a USB type-C receptacle is assembled on the DART-MX8M custom board.
To use it as host only or peripheral only you need to change the value of the dr_mode property under the USB node in the device tree.
dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"

For example:
Follow either the "Build the Linux kernel from source code" or "Customizing the Linux kernel" Wiki pages and edit the following device tree file:
arch/arm64/boot/dts/freescale/fsl-imx8mm-var-dart.dts

&usbotg1 <span class="br0">{</span>
<span class="re7">-	dr_mode = "otg";</span>
<span class="re8">+       dr_mode = "host";</span>
	picophy,pre-emp-curr-control = <<span class="nu0">3</span>>;
	picophy,dc-vol-level-adjust = <<span class="nu0">7</span>>;
	status = "okay";
<span class="br0">}</span>;

If you build the kernel manually from source code, you should build only the device trees and copy them to your SD card or eMMC.

Note: You can read the current dr_mode value on a running target, by executing the following command:

# cat /sys/firmware/devicetree/base/usb@32e40000/dr_mode; echo

2 Using the USB OTG port under Linux

2.1 As host (default)

<a href="/index.php?title=IMX_USB_Host" title="IMX USB Host">USB host</a>

2.2 As peripheral

In order to use the board as a peripheral, an appropriate module needs to be loaded.
For example, there is an Ethernet gadget module called g_ether, a mass storage gadget called g_mass_storage, a serial gadget called g_serial, etc.

Example using the g_mass_storage module to expose the root partition on eMMC to a PC while booting from recovery SD card:
Connect a type-C plug to Standard-A plug cable between the board and a PC, and run the following on the board:

# umount /dev/mmcblk2p1
# modprobe g_mass_storage file=/dev/mmcblk2p1

The partition should be loaded on the PC as a mass storage device.

2.3 As OTG

With OTG, the board can be either a host, or a peripheral.
In order to use it as a host and connect a peripheral (e.g. a USB flash drive) to it, either use a peripheral with type-C connector or use type-C to type-A adapter.
In order to use it as a peripheral and connect it to a PC, for example, a cable with a type-C plug on one end and a Standard-A plug on the other is needed.