Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX6UL-L/Peripherals/USB OTG

609 bytes removed, 11 January
m
U0007 moved page DESK-MX6UL-L/Pheripherals/USB OTG to DESK-MX6UL-L/Peripherals/USB OTG without leaving a redirect
<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{{oldid|14250|2021/07/20}}| 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-MX6UL-L release|-| 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" |{{oldid|16316|2022/03/16}}| 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" |DESK-MX6UL-L 3.0.0release|-! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fbededed; padding:5px; color:#000000"|Apr 20212023/05/04|! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fbededed; padding:5px; color:#000000"|First DESK -MX6UL-L 4.0.0 release
|}
<section end="History" /><section begin="Body" />
==Peripheral USB OTG ==
The USB OTG ports can be configured as Host or Device mode depending on the device tree configuration. In OTG mode they 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.
In {{ImportantMessage|text=The USB OTG mode they can be easily tested using the Mass Storage Gadget, which lets the device export a file peripheral is not available - ''as a mass storage device to default option'' - on [[AXEL_ULite_SOM/AXEL_ULite_Evaluation_Kit | AXEL ULite EVK]]. Please contact [mailto:sales@dave.eu Sales department] for this option.<br>This peripheral is available on the connected PCi.MX6UL standard product [[SBC_Lynx_SBC | SBCLynx]]}}
=== Device tree configuration ===
Here below an example of device tree configuration used on standard DAVE's kit for the [[AXEL ULite SOM]] where USB OTG1 is configured as ''otg'' while the USB OTG2 port is configured in ''host'' mode:
From <code>imx6ul-lynx-som0013-cb002f.dtsidts</code>:
<pre>
&usbotg1 pinctrl_usb_otg2: usbotg2grp { pinctrl-names = "default"; pinctrl-0 fsl,pins = <&pinctrl_usb_otg1_id>; vbus-supply = <&reg_usb_otg1_vbus>; MX6UL_PAD_ENET2_TX_DATA1__GPIO2_IO12 0x17059 /* OTG2_PWR */ dr_mode = "otg"; MX6UL_PAD_ENET2_TX_EN__USB_OTG2_OC 0x17059 /* OTG2_OC */ srp-disable >; hnp-disable }; adp-disable; status = "disabled" };
};
 
&usbotg2 {
vbus-supply = <&reg_usb_otg2_vbus>;
dr_mode = "host";
status = "disabled";
};
...
...
&iomuxc {
...
...
pinctrl_usb_otg1_id: usbotg1idgrp {
fsl,pins = <
MX6UL_PAD_GPIO1_IO00__ANATOP_OTG1_ID 0x17059
>;
};
 
pinctrl_usb_otg1: usbotg1grp {
fsl,pins = <
MX6UL_PAD_ENET2_RX_DATA0__GPIO2_IO08 0x10b0 /* OTG1 PWR */
MX6UL_PAD_ENET2_RX_DATA1__GPIO2_IO09 0x17059 /* OTG1_OC */
>;
};
 
pinctrl_usb_otg1_oc: usbotg1grp1 {
fsl,pins = <
MX6UL_PAD_ENET2_RX_DATA0__GPIO2_IO08 0x10b0 /* OTG1 PWR */
MX6UL_PAD_ENET2_RX_DATA1__USB_OTG1_OC 0x17059 /* OTG1_OC */
>;
};
 
pinctrl_usb_otg2: usbotg2grp {
fsl,pins = <
MX6UL_PAD_ENET2_TX_DATA1__GPIO2_IO12 0x17059 /* OTG2_PWR */
MX6UL_PAD_ENET2_TX_EN__USB_OTG2_OC 0x17059 /* OTG2_OC */
>;
};
 
pinctrl_usb_otg2_1: usbotg2grp-1 {
fsl,pins = <
MX6UL_PAD_UART3_CTS_B__GPIO1_IO26 0x17059 /* OTG2_PWR */
MX6UL_PAD_UART3_RTS_B__GPIO1_IO27 0x17059 /* OTG2_OC */
>;
};
 
</pre>
From and from <code>imx6ul-lynx-som0013-cb002f.dtsdtsi</code>:
<pre>
&reg_usb_otg1_vbus {
pinctrl-0 = <&pinctrl_usb_otg1_oc>;
};
 
&usbotg1 {
over-current-active-low;
status = "okay";
};
 
&usbotg2 {
over-current-active-low;
status = "okay";
};
 
...
...
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog_gpios>;
imx6ul-lynx {...... pinctrl_usb_otg1 pinctrl_usb_otg2: usbotg1grp usbotg2grp { fsl,pins = < MX6UL_PAD_ENET2_RX_DATA0__GPIO2_IO08 MX6UL_PAD_ENET2_TX_DATA1__GPIO2_IO12 0x10b0 0x17059 /* OTG1 PWR OTG2_PWR */ MX6UL_PAD_ENET2_RX_DATA1__USB_OTG1_OC MX6UL_PAD_ENET2_TX_EN__USB_OTG2_OC 0x17059 /* OTG1_OC OTG2_OC */ >; };
pinctrl_usb_otg2 pinctrl_usb_otg2_1: usbotg2grp -1 { fsl,pins = < MX6UL_PAD_ENET2_TX_DATA1__GPIO2_IO12 MX6UL_PAD_UART3_CTS_B__GPIO1_IO26 0x17059 /* OTG2_PWR */ MX6UL_PAD_ENET2_TX_EN__USB_OTG2_OC MX6UL_PAD_UART3_RTS_B__GPIO1_IO27 0x17059 /* OTG2_OC */ >; };
</pre>
 
===Accessing the peripheral===
...
...
[ 3.387128458609] usb_otg1_vbususb usb1: supplied by SWBSTNew USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.15[ 3.467126] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1[ 3.418986474528] usb_otg2_vbususb usb1: supplied by SWBSTProduct: EHCI Host Controller[ 3.479474] usb usb1: Manufacturer: Linux 5.24540815.71-desk-mx6ul-l-4.0.0-rc1+gb3b0d0fd0042 ehci_hcd[ 3.488899] usb_otg1_vbususb usb1: disablingSerialNumber: ci_hdrc.1
...
...
<pre class="workstation-terminal">
root@desk-mx6ul-axelulite:~# [ 431 94.623145701909] usb 1-1: new high-speed USB device number 2 using ci_hdrc[ 431 94.865699910476] usb 1-1: New USB device found, idVendor=095113fe, idProduct=16656700, bcdDevice= 1.10[ 431 94.872537910584] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3[ 431 94.883302910651] usb 1-1: Product: DataTraveler 2USB DISK 3.0[ 431 94.887825910695] usb 1-1: Manufacturer: KingstonWilk[ 431 94.892114910741] usb 1-1: SerialNumber: 50E549C202681071F97202CB07012533C2BE5935[ 431 94.910893932930] usb-storage 1-1:1.0: USB Mass Storage device detected[ 431 94.928942941189] scsi host0: usb-storage 1-1:1.0[ 432 96.966408015256] scsi 0:0:0:0: Direct-Access Kingston DataTraveler 2Wilk USB DISK 3.0 0000 PMAP PQ: 0 ANSI: 46[ 432 96.995263025192] sd 0:0:0:0: [sda] 15151168 60628992 512-byte logical blocks: (731.76 0 GB/728.22 9 GiB)[ 433 96.015350026459] sd 0:0:0:0: [sda] Write Protect is off[ 433 96.026506] sd 0:0:0:0: [sda] Mode Sense: 45 00 00 00[ 96.031915027841] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA[ 433 96.067380093511] sda: sda1sda2[ 433 96.089246105339] sd 0:0:0:0: [sda] Attached SCSI removable disk root@desk-mx6ul-axelulite:~#
</pre>
<pre class="workstation-terminal">
root@desk-mx6ul-axelulitelynx:~# dd if=/dev/zero of=mass_storage count=32 bs=1M
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 30.62181 573118 s, 958.3 5 MB/sroot@desk-mx6ul-axelulitelynx:~# mkfs.msdos mass_storagemkfs.fat 4.1 2 (20172021-01-2431)root@desk-mx6ul-axelulitelynx:~# mkdir looproot@desk-mx6ul-axelulitelynx:~# mount -o loop mass_storage looproot@desk-mx6ul-axelulitelynx:~# echo "Test USB OTG with mass storage device" > loop/usb.txtroot@desk-mx6ul-axelulitelynx:~# umount loop/
</pre>
<pre class="workstation-terminal">
root@desk-mx6ul-axelulitelynx:~# modprobe g_mass_storage removable=y file=mass_storageroot@desk-mx6ul-lynx:~# dmesg | tail -n 7[ 137166.706620355438] Mass Storage Function, version: 2009/09/11[ 137166.711809355484] LUN: removable file: (no medium)[ 137166.731390355723] LUN: removable file: /home/root/mass_storage[ 137166.737101355748] Number of LUNs=1[ 137166.740256365515] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11[ 137166.751272365556] g_mass_storage gadget: userspace failed to provide iSerialNumber[ 137166.760299365572] g_mass_storage gadget: g_mass_storage readyroot@desk-mx6ul-axelulite:~#
</pre>
Once the USB cable is connected to the PC, the kernel prints storage is mounted and the following messages''usb.txt'' file is available:
<pre class="workstation-terminal">
root@desk$ cat /media/tomzy/42D5-mx6ul-axelulite:~# [ 214CBA5/usb.837430] g_mass_storage gadget: high-speed config #1: Linux File-Backed Storagetxt Test USB OTG with mass storage device
</pre>
and the The Windows PC also 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.txtrst''
<section end="Body" />
----
[[Category:AXEL ULite]]
8,221
edits