Transclusion: Debian: iMX7: USB OTG
This section describes USB OTG port (USB host and USB device (gadget) capable port) use cases for following Compulab devices built around the NXP i.MX7 SoC:
- CL-SOM-iMX7
- UCM-iMX7
In the default kernel configuration, the USB host driver is compiled into the kernel, whereas USB gadget drivers are compiled as modules. Gadget drivers should be loaded for OTG support.
Default kernel configuration enables g_serial, g_mass_storage and g_ether gadget drivers.
More gadget drivers can be enabled in the kernel configuration.
Testing OTG port
Host mode
Connect USB keyboard to OTG port.
ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1 ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00 hub 1-0:1.0: USB hub found hub 1-0:1.0: 1 port detected usb 1-1: new low-speed USB device number 2 using ci_hdrc input: DELL Dell USB Entry Keyboard as /devices/soc.2/30800000.aips-bus/30b10000.usb/ci_hdrc.0/usb1/1-1/1-1:1.0/0003:413C:2107.0002/input/input2 hid-generic 0003:413C:2107.0002: input: USB HID v1.10 Keyboard [DELL Dell USB Entry Keyboard] on usb-ci_hdrc.0-1/input0
Gadget mode
- g_mass_storage
root@cl-rootfs:~# modprobe g_mass_storage file=/dev/mmcblk0 Number of LUNs=8 Mass Storage Function, version: 2009/09/11 LUN: removable file: (no medium) Number of LUNs=1 LUN: read only file: /dev/mmcblk0 Number of LUNs=1 g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11 g_mass_storage gadget: userspace failed to provide iSerialNumber g_mass_storage gadget: g_mass_storage ready g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage
Connect desktop PC to OTG port.
In case the desktop PC is running Linux, this gadget will show up in the lsusb list:
Bus 001 Device 047: ID 0525:a4a5 Netchip Technology, Inc. Linux-USB File Storage Gadge
The new device information shows up in the system log.
[1825168.393211] sd 64:0:0:0: Attached scsi generic sg3 type 0 [1825168.393890] sd 64:0:0:0: [sdd] 15523840 512-byte logical blocks: (7.94 GB/7.40 GiB) [1825168.499913] sd 64:0:0:0: [sdd] Write Protect is on [1825168.499919] sd 64:0:0:0: [sdd] Mode Sense: 0f 00 80 00 [1825168.609953] sd 64:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [1825168.839367] sdd: sdd1 [1825169.059950] sd 64:0:0:0: [sdd] Attached SCSI disk
- g_ether
root@cl-rootfs:~# modprobe g_ether using random self ethernet address using random host ethernet address usb0: HOST MAC 12:b1:f6:45:ac:50 usb0: MAC 7a:89:db:ad:9d:60 using random self ethernet address using random host ethernet address g_ether gadget: Ethernet Gadget, version: Memorial Day 2008 g_ether gadget: g_ether ready g_ether gadget: high-speed config #1: CDC Ethernet (ECM)
In case the desktop PC is running Linux, this gadget will show up in the lsusb list:
Bus 001 Device 009: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
A new network interface turns out in the ((cmd|ifconfig -a}} list:
usb0 Link encap:Ethernet HWaddr 12:b1:f6:45:ac:50 inet6 addr: fe80::10b1:f6ff:fe45:ac50/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
- g_serial
root@cl-rootfs:~# modprobe g_serial g_serial gadget: Gadget Serial v2.4 g_serial gadget: g_serial ready g_serial gadget: high-speed config #2: CDC ACM config
In case the desktop PC is running Linux, this gadget will show up in the lsusb list:
Bus 001 Device 055: ID 0525:a4a7 Netchip Technology, Inc. Linux-USB Serial Gadget (CDC ACM mode)
The new device information shows up in the system log.
[184764.380141] cdc_acm 1-1.2.1:2.0: ttyACM0: USB ACM device