DESK-MP1-L/Peripherals/USB Host

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2023/08/02 DESK-MP1-L-1.0.0 release


Peripheral USB Host[edit | edit source]

Device tree configuration[edit | edit source]

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

From kernel device tree stm32mp157a-dcsb5000dd1r.dts:

...
...
&usbh_ehci{
	status = "okay";

	/* USER CODE BEGIN usbh_ehci */
	phys = <&usbphyc_port0>;
	phy-names = "usb";
	/* USER CODE END usbh_ehci */
};

&usbh_ohci{
	status = "okay";

	/* USER CODE BEGIN usbh_ohci */
	/* USER CODE END usbh_ohci */
};

&usbphyc{
	status = "okay";

	/* USER CODE BEGIN usbphyc */
	/* USER CODE END usbphyc */
};

&usbphyc_port0{
	status = "okay";

	/* USER CODE BEGIN usbphyc_port0 */
	phy-supply = <&vdd_usb>;

	connector {
		compatible = "usb-a-connector";
		vbus-supply = <&vbus_sw>;
	};
	/* USER CODE END usbphyc_port0 */
};
...
...


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

[  496.159495] usb 2-1: new high-speed USB device number 2 using ehci-platform
[  496.368878] usb-storage 2-1:1.0: USB Mass Storage device detected
[  496.379336] scsi host0: usb-storage 2-1:1.0
[  496.846840] usbcore: registered new interface driver uas
[  497.441374] scsi 0:0:0:0: Direct-Access      USB      SanDisk 3.2Gen1 1.00 PQ: 0 ANSI: 6
[  497.453487] sd 0:0:0:0: [sda] 60125184 512-byte logical blocks: (30.8 GB/28.7 GiB)
[  497.461344] sd 0:0:0:0: [sda] Write Protect is off
[  497.464745] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[  497.472234] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[  497.488444] sd 0:0:0:0: Attached scsi generic sg0 type 0
[  497.507380]  sda: sda1
[  497.603592] 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-mp1:~# mkdir -p /mnt/usb
root@desk-mp1:~# mount /dev/sda1 /mnt/usb/
root@desk-mp1:~# ls -la /mnt/usb/
total 24
drwxr-xr-x  3 root root   16384 Jan  1  1970  .
drwxr-xr-x  4 root root    4096 Jul 28 13:38  ..
drwx------  2 root root   16384 Jul 28 08:54 lost+found
-rw-r--r--  1 root root 8765832 Jul 28 08:54 uImage