Open main menu

DAVE Developer's Wiki β

DESK-MX8M-L/Peripherals/USB2 OTG

< DESK-MX8M-L
Revision as of 11:30, 30 December 2021 by U0007 (talk | contribs) (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...")

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
History
Version Issue Date Notes
1.0.0 Jan 2022 First DESK-MX8M release


Contents

Peripheral USB HostEdit

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.

Device tree configurationEdit

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

From imx8mp-mito8mplus-cb1001.dts:

	reg_usb2_host_vbus: regulator-usb2-vbus {
		compatible = "regulator-fixed";
		regulator-name = "usb2_host_vbus";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_usb2_vbus>;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		regulator-always-on;
	};
...
...
&usb3_phy1 {
	fsl,phy-tx-preemp-amp-tune = <2>;
	status = "okay";
};

&usb3_1 {
	status = "okay";
};

&usb_dwc3_1 {
	dr_mode = "host";
	status = "okay";
};

Accessing the peripheralEdit

Linux messages at boot timeEdit

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:~# [ 1071.894621] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[ 1072.112493] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 1072.120066] scsi host0: usb-storage 1-1:1.0
[ 1073.137381] scsi 0:0:0:0: Direct-Access     Kingston DataTraveler 2.0 0000 PQ: 0 ANSI: 4
[ 1073.147989] sd 0:0:0:0: [sda] 15151168 512-byte logical blocks: (7.76 GB/7.22 GiB)
[ 1073.157372] sd 0:0:0:0: [sda] Write Protect is off
[ 1073.163950] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 1073.202664]  sda: sda1
[ 1073.211474] sd 0:0:0:0: [sda] Attached SCSI removable disk
root@desk-mx8mp:~#

Additional informationEdit

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