Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX6-L/Peripherals/USB OTG

4,103 bytes added, 14:39, 13 October 2020
Created page with "<section begin=History/> {| style="border-collapse:collapse; " !colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History |- !style="border-le..."
<section begin=History/>
{| style="border-collapse:collapse; "
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
|-
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Version
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Issue Date
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|1.0.0
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Oct 2020
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First DESK release
|}
<section end=History/>
<section begin=Body/>

==Peripheral USB OTG ==

The USB OTG feature can be easily tested using the Mass Storage Gadget, which lets the device export a file as a mass storage device to the connected PC.

=== Device tree configuration ===

Here below an example of device tree configuration used on standard DAVE's kit for the AXEL Lite SOM:

From <code>imx6qdl-axelcommon.dtsi</code>:

<pre>
&usbotg {
vbus-supply = <&reg_usb_otg_vbus>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usbotg_2>;
disable-over-current;
status = "okay";
};
...
...
&iomuxc {
...
...
usbotg {
pinctrl_usbotg_2: usbotggrp-2 {
fsl,pins = <
MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID 0x17059
>;
};
};
};
</pre>

===Accessing the peripheral===
====Linux messages at boot time====

<pre class="workstation-terminal">
...
...
[ 4.954820] usb_otg_vbus: disabling
...
...
</pre>

==== Usage with [https://www.kernel.org/doc/Documentation/usb/mass-storage.txt mass-storage] ====

<pre class="workstation-terminal">
root@imx6qdlxelk:~# dd if=/dev/zero of=mass_storage count=256 bs=1M
256+0 records in
256+0 records out
268435456 bytes (268 MB, 256 MiB) copied, 15.924 s, 16.9 MB/s
root@imx6qdlxelk:~# mkfs.msdos mass_storage
mkfs.fat 4.1 (2017-01-24)
root@imx6qdlxelk:~# mkdir loop
root@imx6qdlxelk:~# mount -o loop mass_storage loop
root@imx6qdlxelk:~# echo "Test USB OTG with mass storage device" > loop/usb.txt
root@imx6qdlxelk:~# umount loop
</pre>

then insert the <code>g_mass_storage</code> kernel module driver enabling an Windows PC to see it as a ''removable device''

<pre class="workstation-terminal">
root@imx6qdlxelk:~# modprobe g_mass_storage removable=y file=mass_storage
[ 891.807023] Mass Storage Function, version: 2009/09/11
[ 891.813145] LUN: removable file: (no medium)
[ 891.818901] LUN: removable file: /home/root/mass_storage
[ 891.824754] Number of LUNs=1
[ 891.827901] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[ 891.834955] g_mass_storage gadget: userspace failed to provide iSerialNumber
[ 891.842109] g_mass_storage gadget: g_mass_storage ready
root@imx6qdlxelk:~#
</pre>

Once the USB cable is connected to the PC, the kernel prints the following messages:

<pre class="workstation-terminal">
root@imx6qdlxelk:~# [ 892.036840] g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage
</pre>

and the Windows PC activate the driver and the disk is available as a Drive Unit (with the ''usb.txt'' file available).

=== Additional information ===

More information about Mass Storage Gadget driver is given in the kernel tree under ''Documentation/usb/mass-storage.txt''

<section end=Body/>

----

[[Category:AXEL Lite]]
8,286
edits