Difference between revisions of "DESK-MX6-L/Pheripherals/USB Host"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "{{subst:Peripheral | nome-som=AXEL Lite | nome-peripheral = USB Host }}")
 
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<section begin=History/>
+
<section begin="History" />
 
{| style="border-collapse:collapse; "
 
{| style="border-collapse:collapse; "
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
+
! 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"|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:#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"|X.Y.Z
+
| 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|14091|2021/07/16}}
|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"|Month Year
+
| 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-MX6-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"|TBD
 
 
|-
 
|-
 +
| 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|17002|2022/03/03}}
 +
| 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-MX6-L 3.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:#edf8fb; padding:5px; color:#000000"|[TBD_link X.Y.Z]
+
! 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" |2023/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:#edf8fb; padding:5px; color:#000000"|Month Year
+
! 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-MX6-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:#edf8fb; padding:5px; color:#000000"|TBD
 
|-
 
|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"|...
 
|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"|...
 
|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"|...
 
 
|-
 
|-
 
|}
 
|}
<section end=History/>
+
<section end="History" />
<section begin=Body/>
+
<section begin="Body" />
  
 
==Peripheral USB Host ==
 
==Peripheral USB Host ==
  
''TBD: sostituire tutti i dump con le informazioni sull'uso della periferica''
+
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 ===
 
=== Device tree configuration ===
 +
 
Here below an example of device tree configuration used on standard DAVE's kit for the AXEL Lite SOM:
 
Here below an example of device tree configuration used on standard DAVE's kit for the AXEL Lite SOM:
  
From <code>''carrier.dts''</code>:
+
From <code>imx6qdl-axelcommon.dtsi</code>:
  
 
<pre>
 
<pre>
&can1 {
+
    regulators {
    pinctrl-names = "default";
+
        compatible = "simple-bus";
     pinctrl-0 = <&pinctrl_flexcan1_axel>;
+
 +
        reg_usb_h1_vbus: usb_h1_vbus {
 +
            compatible = "regulator-fixed";
 +
            regulator-name = "usb_h1_vbus";
 +
            regulator-min-microvolt = <5000000>;
 +
            regulator-max-microvolt = <5000000>;
 +
            gpio = <&gpio2 11 0>;
 +
            enable-active-high;
 +
        };
 +
    };
 +
...
 +
...
 +
&usbh1 {
 +
     vbus-supply = <&reg_usb_h1_vbus>;
 
     status = "okay";
 
     status = "okay";
 
};
 
};
</pre>
 
 
From <code>''carrier-common.dtsi''</code>:
 
 
<pre>
 
    can1 {
 
        pinctrl_flexcan1_axel: flexcan1axelgrp-1 {
 
            fsl,pins = <
 
                MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x80000000
 
                MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x80000000
 
            >;
 
        };
 
    };
 
 
</pre>
 
</pre>
  
Line 57: Line 53:
 
====Linux messages at boot time====
 
====Linux messages at boot time====
  
<pre class="workstation-terminal">
+
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.)
...
 
...
 
[    1.807495] flexcan 2090000.flexcan: 2090000.flexcan supply xceiver not found, using dummy regulator
 
[    1.817366] flexcan 2090000.flexcan: device registered (reg_base=c0a30000, irq=31)
 
...
 
...
 
[    3.952659] can: controller area network core (rev 20170425 abi 9)
 
[    3.963413] can: raw protocol (rev 20170425)
 
[    3.967717] can: broadcast manager protocol (rev 20170425 t)
 
[    3.973397] can: netlink gateway (rev 20170425) max_hops=1
 
</pre>
 
  
====Enable the interface and check status====
 
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@imx6qxelk:~# ip link set can0 type can bitrate 500000
+
[  949.174288] usb 1-1: New USB device found, idVendor=13fe, idProduct=6700, bcdDevice= 1.10
root@imx6qxelk:~# ifconfig can0 up
+
[  949.182598] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
root@imx6qxelk:~# ifconfig can0
+
[  949.192339] usb 1-1: Product: USB DISK 3.0
can0      Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
+
[  949.196474] usb 1-1: Manufacturer: Wilk
          UP RUNNING NOARP MTU:16  Metric:1
+
[ 949.202608] usb 1-1: SerialNumber: 07012533C2BE5935
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
+
[  949.216478] usb-storage 1-1:1.0: USB Mass Storage device detected
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
+
[ 949.234501] scsi host0: usb-storage 1-1:1.0
          collisions:0 txqueuelen:10
+
[  950.319317] scsi 0:0:0:0: Direct-Access    Wilk    USB DISK 3.0     PMAP PQ: 0 ANSI: 6
          RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
+
[  950.334575] sd 0:0:0:0: [sda] 60628992 512-byte logical blocks: (31.0 GB/28.9 GiB)
          Interrupt:31
+
[  950.343311] sd 0:0:0:0: [sda] Write Protect is off
 
+
[  950.357023] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
root@imx6qxelk:~#
+
[  950.421972] sda: sda1 sda2
 +
[  950.433822] sd 0:0:0:0: [sda] Attached SCSI removable disk
 
</pre>
 
</pre>
  
==== Usage with [https://github.com/linux-can/can-utils can-utils] ====
+
=== Additional information ===
 
+
If the root file system configuration does not automatically mount the partition, it is possible to mount the device using the following command:
''TBD: reference verso eventuali informazioni sul web''
 
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@imx6qxelk:~# ip link set can0 type can bitrate 500000 triple-sampling on
+
root@desk-mx6:~# mkdir -p /mnt/usb
root@imx6qxelk:~# ifconfig can0 up
+
root@desk-mx6:~# mount /dev/sda1 /mnt/usb/
root@imx6qxelk:~# cansend can0 128#1122334455667788
+
root@desk-mx6:~# ls -la /mnt/usb/
root@imx6qxelk:~# candump can0
+
total 24
  can0 128  [8] 11 22 33 44 55 66 77 88
+
drwxrwx--- 3 root disk    16384 Jan  1  1970 .
root@imx6qxelk:~#
+
drwxr-xr-x 6 root root     4096 Apr  4 07:11 ..
 +
drwxrwx--- 3 root disk    2048 Apr 5 2011 EFI
 +
-rwxrwx--- 1 root disk 10193056 Apr  5  2011 uImage
 
</pre>
 
</pre>
  
=== Additional information ===
+
<section end="Body" />
Each CAN port appears like a networking interface in the form <code>canX</code> where <b><i>X</i></b> is the port number.
 
 
 
Information about programming the CAN socket interface is given in the kernel tree under ''Documentation/networking/can.txt''
 
<section end=Body/>
 
  
 
----
 
----
  
 
[[Category:AXEL Lite]]
 
[[Category:AXEL Lite]]

Latest revision as of 17:04, 8 January 2024

History
Issue Date Notes

2021/07/16

First DESK-MX6-L release

2022/03/03

DESK-MX6-L 3.0.0 release
2023/04/11 DESK-MX6-L 4.0.0 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 Lite SOM:

From imx6qdl-axelcommon.dtsi:

    regulators {
        compatible = "simple-bus";
 
        reg_usb_h1_vbus: usb_h1_vbus {
            compatible = "regulator-fixed";
            regulator-name = "usb_h1_vbus";
            regulator-min-microvolt = <5000000>;
            regulator-max-microvolt = <5000000>;
            gpio = <&gpio2 11 0>;
            enable-active-high;
        };
    };
...
...
&usbh1 {
    vbus-supply = <&reg_usb_h1_vbus>;
    status = "okay";
};

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.)

[  949.174288] usb 1-1: New USB device found, idVendor=13fe, idProduct=6700, bcdDevice= 1.10
[  949.182598] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  949.192339] usb 1-1: Product: USB DISK 3.0
[  949.196474] usb 1-1: Manufacturer: Wilk
[  949.202608] usb 1-1: SerialNumber: 07012533C2BE5935
[  949.216478] usb-storage 1-1:1.0: USB Mass Storage device detected
[  949.234501] scsi host0: usb-storage 1-1:1.0
[  950.319317] scsi 0:0:0:0: Direct-Access     Wilk     USB DISK 3.0     PMAP PQ: 0 ANSI: 6
[  950.334575] sd 0:0:0:0: [sda] 60628992 512-byte logical blocks: (31.0 GB/28.9 GiB)
[  950.343311] sd 0:0:0:0: [sda] Write Protect is off
[  950.357023] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[  950.421972]  sda: sda1 sda2
[  950.433822] 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-mx6:~# mkdir -p /mnt/usb
root@desk-mx6:~# mount /dev/sda1 /mnt/usb/
root@desk-mx6:~# ls -la /mnt/usb/
total 24
drwxrwx--- 3 root disk    16384 Jan  1  1970 .
drwxr-xr-x 6 root root     4096 Apr  4 07:11 ..
drwxrwx--- 3 root disk     2048 Apr  5  2011 EFI
-rwxrwx--- 1 root disk 10193056 Apr  5  2011 uImage