DESK-MX6UL-L/Pheripherals/USB Host

From DAVE Developer's Wiki
Jump to: navigation, search
History
Version Issue Date Notes
1.0.0 Jul 2021 First DESK release


Peripheral USB Host[edit | edit source]

The USB Host port requires to configure the USB VBUS regulator and the gpio used for enabling the 5V USB power switch.

Device tree configuration[edit | edit source]

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

From imx6ul-axelulite-cb003a.dts:

        reg_usb_otg1_vbus: regulator@2 {
                compatible = "regulator-fixed";
                reg = <2>;
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_usb_otg1>;
                regulator-name = "usb_otg1_vbus";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                gpio = <&gpio1 18 GPIO_ACTIVE_HIGH>;
                enable-active-high;
        };
...
...
&usbotg1 {
        vbus-supply = <&reg_usb_otg1_vbus>;
        disable-over-current;
        dr_mode = "host";
        status = "okay";
};
...
...
&iomuxc {
        pinctrl-0 = <&pinctrl_hog_gpios>;
        imx6ul-axelulite {
...
...
                pinctrl_usb_otg1: usbotg1grp {
                        fsl,pins = <
                                MX6UL_PAD_UART1_CTS_B__GPIO1_IO18       0x10b0          /* HOST PWR */
                                MX6UL_PAD_GPIO1_IO03__GPIO1_IO03        0x10b0          /* HOST OC */
                        >;
                };
};


Accessing the peripheral[edit | edit source]

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. xlass, vendor id, product id, etc.)

root@desk-mx6ul-axelulite:~# [  564.193377] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[  564.435616] usb 1-1: New USB device found, idVendor=0951, idProduct=1665
[  564.442457] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  564.457846] usb 1-1: Product: DataTraveler 2.0
[  564.462455] usb 1-1: Manufacturer: Kingston
[  564.474290] usb 1-1: SerialNumber: 50E549C202681071F97202CB
[  564.488603] usb-storage 1-1:1.0: USB Mass Storage device detected
[  564.508986] scsi host0: usb-storage 1-1:1.0
[  565.526470] scsi 0:0:0:0: Direct-Access     Kingston DataTraveler 2.0 0000 PQ: 0 ANSI: 4
[  565.555313] sd 0:0:0:0: [sda] 15151168 512-byte logical blocks: (7.76 GB/7.22 GiB)
[  565.583739] sd 0:0:0:0: [sda] Write Protect is off
[  565.599208] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[  565.637032]  sda: sda1
[  565.663492] sd 0:0:0:0: [sda] Attached SCSI removable disk

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-mx6ul-axelulite:~# mkdir -p /mnt/usb
root@desk-mx6ul-axelulite:~# mount /dev/sda1 /mnt/usb
[  640.717947] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
root@desk-mx6ul-axelulite:~#  ls -la /mnt/usb
total 6756
drwxr-xr-x 3 root root   16384 Jan  1  1970 .
drwxr-xr-x 4 root root    4096 Oct  7 16:33 ..
drwxr-xr-x 2 root root   16384 Feb 26  2020 System Volume Information
-rwxr-xr-x 1 root root 6881192 Mar 31  2020 uImage-4.14.98-xelk-5.0.0-rc2+gb0960b6
root@desk-mx6ul-axelulite:~#