Difference between revisions of "DESK-MX8M-L/Peripherals/USB2 OTG"

From DAVE Developer's Wiki
Jump to: navigation, search
(Peripheral USB Host)
m (U0007 moved page DESK-MX8M-L/Pheripherals/USB Host to DESK-MX8M-L/Pheripherals/USB2 OTG without leaving a redirect)
(No difference)

Revision as of 08:41, 16 February 2023

History
Version Issue Date Notes
1.0.0 Jan 2022 First DESK-MX8M release
2.0.0 Feb 2023 DESK-MX8M-L-2.0.0


Peripheral USB Host[edit | edit source]

Device tree configuration[edit | edit source]

ORCA SOM[edit | edit source]

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:

From imx8mp-mito8mplus-cb1001.dts:

...
...
&usb3_phy0 {
	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 = <0x7f>;
	status = "okay";
};

&usb3_0 {
	status = "okay";
};

&usb_dwc3_0 {
	dr_mode = "host";
	status = "okay";

	port {
		usb3_drd_sw: endpoint {
			remote-endpoint = <&typec_dr_sw>;
		};
	};
};

MITO 8M Mini[edit | edit source]

Here below an example of device tree configuration used on standard DAVE's kit for the MITO 8M Mini:

From imx8mm-mito8mmini.dts:

...
...
&usbotg2 {
	dr_mode = "host";
	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";
};
...
...
&iomuxc {
...
...
	pinctrl_usb_pwr: usbpwrgrp {
		fsl,pins = <
			MX8MM_IOMUXC_GPIO1_IO12_GPIO1_IO12			  0x19
		>;
	};
...
...
};

Accessing the peripheral[edit | edit source]

This procedure is the same for both ORCA SOM and MITO 8M Mini.

Linux messages at boot time[edit | edit source]

When a USB 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.)

root@desk-mx8mp:~# [ 2406.464399] usb 6-1: USB disconnect, device number 2
[ 2407.644440] 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 host0: usb-storage 2-1.3:1.0
[ 2408.691090] scsi 0:0:0:0: Direct-Access     HYPER    FLASHDISK        1507 PQ: 0 ANSI: 0
[ 2408.701469] sd 0:0:0:0: [sda] 129630208 512-byte logical blocks: (66.4 GB/61.8 GiB)
[ 2408.709458] sd 0:0:0:0: [sda] Write Protect is off
[ 2408.714509] sd 0:0:0:0: [sda] No Caching mode page found
[ 2408.719856] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 2408.743246]  sda: sda1
[ 2408.747220] sd 0:0:0:0: [sda] Attached SCSI removable disk
root@desk-mx8mp:~#

Additional information[edit | edit source]

If the root file system configuration does not automatically mount the partition, it is possible to mount the device using the following command:

root@desk-mx8mp:~# mkdir -p /mnt/usb
root@desk-mx8mp:~# mount /dev/sda1 /mnt/usb
[ 1245.415662] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
root@desk-mx8mp:~# ls -la /mnt/usb
total 128
drwxr-xr-x 10 root root  4096 Jan  1  1970 .
drwxr-xr-x  3 root root  4096 Dec 30 11:24 ..
drwxr-xr-x  2 root root  4096 May 13  2021 System Volume Information
drwxr-xr-x  2 root root  4096 Nov 17 15:27 boot
-rwxr-xr-x  1 root root  8016 Nov 17 15:27 boot.scr
-rwxr-xr-x  1 root root  1712 Dec 10 16:16 config.txt
drwxr-xr-x  2 root root  4096 Nov 17 15:27 rfs
-rwxr-xr-x  1 root root 57458 Nov 17 15:27 run-system-update.sh
-rwxr-xr-x  1 root root   531 Nov 17 15:27 settings.txt