Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX8M-L/Peripherals/USB2 OTG

4,464 bytes added, 15 April
no edit summary
!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|15718|2021/12/30}}|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-MX8M-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|17615|2023/02/24}}| 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-MX8M-L-2.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:#edf8fb; padding:5px; color:#000000"|Jan 2022{{oldid|17615|2023/08/22}}|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-MX8M -L-4.0.0 release|-! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |2024/04/11! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |DESK-MX8M-L-4.1.0 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"|2.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"|Feb 2023
|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-MX8M-L-2.0.0
|}
<section end=History/>
<section begin=Body/>
==Peripheral USB Host USB2 OTG ==
=== Device tree configuration ===
==== ORCA SOM ====
 
The USB2 Type-C port requires to configure the USB VBUS regulator and the '''gpio''' used for enabling the 5V USB power switch in Host mode.
Here below an example of device tree configuration used on standard DAVE's kit for the ORCA SOM:
...
...
&usb3_phy0 usb3_phy1 { vbus-power-supply = <&ptn5110>; fsl,phy-tx-vref-tune = <6>; fsl,phy-tx-rise-tune = <0>; fsl,phy-tx-preemp-amp-tune = <3>; fsl,phy-comp-dis-tune = <7>; fsl,pcs-tx-deemph-3p5db = <0x21>; fsl,phy-pcs-tx-swing-full = <0x7f2>;
status = "okay";
};
&usb3_0 usb3_1 {
status = "okay";
};
&usb_dwc3_0 usb_dwc3_1 { dr_mode = "hostotg"; extcon = <&extcon_usbotg2>; hnp-disable; srp-disable; adp-disable; rsp-disable; disable-over-current;
status = "okay";
 
port {
usb3_drd_sw: endpoint {
remote-endpoint = <&typec_dr_sw>;
};
};
};
......
</pre>
Here below an example of device tree configuration used on standard DAVE's kit for the MITO 8M Mini:
From <code>imx8mm-mito8mmini.dtsdtsi</code>:
<pre>
&usbotg2 {
dr_mode = "host";
picophy,pre-emp-curr-control = <3>;
picophy,dc-vol-level-adjust = <7>;
status = "disabled";
};
...
...
</pre>
 
From <code>imx8mm-mito8mmini-sbcx.dts</code>:
 
<pre>
...
...
/ {
 
regulators: regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;
 
reg_usb_pwr: usb_pwr {
compatible = "regulator-fixed";
regulator-name = "usb_pwr_en";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
...
...
};
};
...
...
&usbotg2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usb_pwr>;
vbus-supply = <&reg_usb_pwr>;
picophy,pre-emp-curr-control = <3>;
picophy,dc-vol-level-adjust = <7>;
status = "okay";
};
};
</pre>
...
...
</pre>
 
===Accessing the peripheral SBC ORCA===
===Accessing =Linux messages in host mode==== When a USB 2.0 peripheral is inserted, in the following example a memory mass storage device, the kernel recognizes the device (i.e. class, vendor id, product id, etc.) <pre class="workstation-terminal">root@desk-mx8mp:~# [ 949.406404] [ 6491.481175] usb 3-1: new high-speed USB device number 3 using xhci-hcd[ 6491.639810] usb-storage 3-1:1.0: USB Mass Storage device detected [ 6491.646905] scsi host0: usb-storage 3-1:1.0 [ 6493.775259] scsi 0:0:0:0: Direct-Access Fanxiang F206 1100 PQ: 0 ANSI: 4[ 6493.786654] sd 0:0:0:0: [sda] 61440000 512-byte logical blocks: (31.5 GB/29.3 GiB) [ 6493.795475] sd 0:0:0:0: [sda] Write Protect is off [ 6493.801799] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA[ 6493.818546] sda: sda1 [ 6493.824653] sd 0:0:0:0: [sda] Attached SCSI removable diskroot@desk-mx8mp:~#</pre> When a USB 3.0 peripheralis inserted, in the following example a memory mass storage device, the kernel recognizes the device (i.e. class, vendor id, product id, etc.) <pre class==="workstation-terminal">root@desk-mx8mp:~# [ 6798.669673] usb 4-1: new SuperSpeed USB device number 3 using xhci-hcd[ 6798.703673] usb-storage 4-1:1.0: USB Mass Storage device detected[ 6798.710479] scsi host1: usb-storage 4-1:1.0[ 6799.719808] scsi 1:0:0:0: Direct-Access Wilk USB DISK 3.0 PMAP PQ: 0 ANSI: 6[ 6799.732902] sd 1:0:0:0: [sdb] 60628992 512-byte logical blocks: (31.0 GB/28.9 GiB)[ 6799.741747] sd 1:0:0:0: [sdb] Write Protect is off[ 6799.747177] sd 1:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA[ 6799.934800] sdb:[ 6799.940848] sd 1:0:0:0: [sdb] Attached SCSI removable disk</pre>
This procedure is the same for both ORCA SOM and MITO 8M Mini==== Usage in device mode with [https://www. kernel.org/doc/Documentation/usb/mass-storage.txt mass-storage] ====
<pre class="workstation-terminal">root@desk-mx8mp:~# dd if=/dev/zero of=mass_storage count=Linux messages at boot time===256 bs=1M256+0 records in 256+0 records out 268435456 bytes (268 MB, 256 MiB) copied, 0.987911 s, 272 MB/sroot@desk-mx8mp:~# mkfs.msdos mass_storage mkfs.fat 4.2 (2021-01-31)root@desk-mx8mp:~# mkdir looproot@desk-mx8mp:~# mount -o loop mass_storage loop[ 6664.248804] loop0: detected capacity change from 0 to 524288root@desk-mx8mp:~# echo "Test USB OTG with mass storage device" > loop/usb.txtroot@desk-mx8mp:~# umount looproot@desk-mx8mp:~# </pre>
When a USB peripheral is inserted, in then insert the following example <code>g_mass_storage</code> kernel module driver enabling an Windows PC to see it as a memory mass storage device, the kernel recognizes the ''removable device (i.e. class, vendor id, product id, etc.)''
<pre class="workstation-terminal">
root@desk-mx8mp:~# [ 2406.464399] usb 6-1: USB disconnect, device number 2modprobe g_mass_storage removable=y file=mass_storage[ 24076677.644440844877] usb 2-1.3: new SuperSpeed Gen 1 USB device number 3 using xhci-hcd[ 2407.670023] usb-storage 2-1.3:1.0: USB Mass Storage device detected[ 2407.677192] scsi host0Function, version: usb-storage 2-1.3:1.02009/09/11[ 24086677.691090850190] scsi 0LUN:0:0:0: Direct-Access HYPER FLASHDISK 1507 PQ: 0 ANSI: 0[ 2408.701469] sd 0:0:0:0: [sda] 129630208 512-byte logical blocksremovable file: (66.4 GB/61.8 GiBno medium)[ 24086677.709458854585] sd 0LUN:0removable file:0:0: [sda] Write Protect is off/home/root/mass_storage[ 24086677.714509859933] sd 0:0:0:0: [sda] No Caching mode page foundNumber of LUNs=1[ 24086677.719856863239] sd 0g_mass_storage gadget:0Mass Storage Gadget, version:0:0: [sda] Assuming drive cache: write through2009/09/11[ 24086677.743246870221] sdag_mass_storage gadget: sda1userspace failed to provide iSerialNumber[ 24086677.747220877281] sd 0:0:0g_mass_storage gadget:0: [sda] Attached SCSI removable diskg_mass_storage ready
root@desk-mx8mp:~#
</pre>
Once the USB cable is connected to the PC, the kernel prints the following messages: <pre class="workstation-terminal">root@desk-mx8mp:~# [ 1493.477167] 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). ===Accessing the peripheral MITO 8M Mini=== ====Linux messages==== When a USB 2.0 peripheral is inserted, in the following example a memory mass storage device, the kernel recognizes the device (i.e. class, vendor id, product id, etc.) <pre class="workstation-terminal">root@desk-mx8mm:~# [ 22.858909] usb 1-1: new high-speed USB device number 2 using ci_hdrc[ 23.022240] usb-storage 1-1:1.0: USB Mass Storage device detected[ 23.028819] scsi host0: usb-storage 1-1:1.0[ 24.045317] scsi 0:0:0:0: Direct-Access SanDisk Cruzer Force 1.00 PQ: 0 ANSI: 6[ 24.055280] sd 0:0:0:0: [sda] 60088320 512-byte logical blocks: (30.8 GB/28.7 GiB)[ 24.063993] sd 0:0:0:0: [sda] Write Protect is off[ 24.069617] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA[ 24.142194] sda: sda1[ 24.150358] sd 0:0:0:0: [sda] Attached SCSI removable disk</pre> === Additional information in host mode === 
If the root file system configuration does not automatically mount the partition, it is possible to mount the device using the following command:
----
[[Category:ORCA]] [[Category:MITO 8M Mini]]
dave_user
424
edits