DESK-MX9-L/Peripherals/USB1 OTG

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes

2024/01/30

DESK-MX9-L-5.x.x release
2026/02/16 DESK-MX9-L-6.x.x release



Peripheral USB1 OTG[edit | edit source]

AURA SOM supports OTG/Host/Peripheral modes: on AURA Evaluation Kit the USB1 OTG port is configured as peripheral.

Device tree configuration[edit | edit source]

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

From kernel device tree imx93-aura.dtsi:

...
&usbotg1 {
	dr_mode = "peripheral";
	hnp-disable;
	srp-disable;
	adp-disable;
	disable-over-current;
	samsung,picophy-pre-emp-curr-control = <3>;
	samsung,picophy-dc-vol-level-adjust = <7>;
	status = "disabled";
};
...

From kernel device tree imx93-aura-sbcx.dtsi:

/ {
...
&usbotg1 {
	dr_mode = "peripheral";
	status = "okay";
};
...

Accessing the peripheral[edit | edit source]

Usage with mass-storage[edit | edit source]

root@desk-mx93-rev1:~# dd if=/dev/zero of=mass_storage count=256 bs=1M
256+0 records in
256+0 records out
268435456 bytes (268 MB, 256 MiB) copied, 0.583141 s, 460 MB/s
root@desk-mx93-rev1:~# mkfs.msdos mass_storage
mkfs.fat 4.2 (2021-01-31)
root@desk-mx93-rev1:~#
root@desk-mx93-rev1:~# mkdir loop
root@desk-mx93-rev1:~# mount -o loop mass_storage loop
root@desk-mx93-rev1:~# echo "Test USB OTG with mass storage device" > loop/usb.txt
root@desk-mx93-rev1:~# umount loop
root@desk-mx93-rev1:~#

then insert the g_mass_storage kernel module driver enabling an Windows PC to see it as a removable device

root@desk-mx93-rev1:~# modprobe g_mass_storage removable=y file=mass_storage
[  956.067086] Mass Storage Function, version: 2009/09/11
[  956.072249] LUN: removable file: (no medium)
[  956.077037] LUN: removable file: /root/mass_storage
[  956.082066] Number of LUNs=1
[  956.085113] g_mass_storage gadget.0: Mass Storage Gadget, version: 2009/09/11
[  956.092277] g_mass_storage gadget.0: userspace failed to provide iSerialNumber
[  956.099516] g_mass_storage gadget.0: g_mass_storage ready

Once the USB cable is connected to the PC, the kernel prints the following messages:

[10029.505852] usb 1-1.1: USB disconnect, device number 6
[10031.752740] usb 1-1.1: new high-speed USB device number 7 using xhci_hcd
[10031.842231] usb 1-1.1: New USB device found, idVendor=0525, idProduct=a4a5, bcdDevice= 6.06
[10031.842259] usb 1-1.1: New USB device strings: Mfr=3, Product=4, SerialNumber=0
[10031.842274] usb 1-1.1: Product: Mass Storage Gadget
[10031.842287] usb 1-1.1: Manufacturer: Linux 6.6.52-desk-mx9-l-6.0.0-lts-next-lts-next-gf90bc32626fe with 4c100000.usb
[10031.844420] usb-storage 1-1.1:1.0: USB Mass Storage device detected
[10031.845248] usb-storage 1-1.1:1.0: Quirks match for vid 0525 pid a4a5: 10000
[10031.845454] scsi host0: usb-storage 1-1.1:1.0
[10032.865376] scsi 0:0:0:0: Direct-Access     Linux    File-Stor Gadget 0606 PQ: 0 ANSI: 2
[10032.867719] sd 0:0:0:0: Power-on or device reset occurred
[10032.871739] sd 0:0:0:0: [sda] 524288 512-byte logical blocks: (268 MB/256 MiB)
[10032.910957] sd 0:0:0:0: Attached scsi generic sg0 type 0
[10032.977486] sd 0:0:0:0: [sda] Write Protect is off
[10032.977517] sd 0:0:0:0: [sda] Mode Sense: 0f 00 00 00
[10033.085505] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[10033.333543]  sda:
[10033.333718] sd 0:0:0:0: [sda] Attached SCSI removable disk