Open main menu

DAVE Developer's Wiki β

DESK-MX8M-L/Peripherals/USB2 OTG

< DESK-MX8M-L
Revision as of 14:59, 15 February 2023 by U0028 (talk | contribs) (Accessing the peripheral)

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


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

ORCAEdit

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>;
		};
	};
};

MINIEdit

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

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 peripheralEdit

This procedure is the same for both ORCA and MINI.

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:~# [ 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 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