The PanGu development board provides a Micro USB OTG interface, which defaults to Host mode.
Host mode
Use the Micro USB to USB Type A conversion cable directly, connect the USB flash drive to the development board, and the development board will automatically identify the USB device. The partition format of the U disk supports FAT32, EXT4. In the following example, a USB card reader is inserted. The SD on the card reader has 5 partitions.
root@stm32mp1:~# [ 249.888684] usb 2-1: new high-speed USB device number 2 using dwc2[ 250.145373] usb-storage 2-1:1.0: USB Mass Storage device detected[ 250.151823] scsi host0: usb-storage 2-1:1.0[ 250.339823] usbcore: registered new interface driver uas[ 251.490554] scsi 0:0:0:0: Direct-Access SD Card Reader 1.00 PQ: 0 ANSI: 6[ 251.503690] sd 0:0:0:0: [sda] 15122432 512-byte logical blocks: (7.74 GB/7.21 GiB)[ 251.512018] sd 0:0:0:0: [sda] Write Protect is off[ 251.516889] sd 0:0:0:0: Attached scsi generic sg0 type 0[ 251.528144] sd 0:0:0:0: [sda] No Caching mode page found[ 251.538272] sd 0:0:0:0: [sda] Assuming drive cache: write through[ 251.565430] sda: sda1 sda2 sda3 sda4 sda5[ 251.573607] sd 0:0:0:0: [sda] Attached SCSI removable diskroot@stm32mp1:~# ls /dev/sdasda sda1 sda2 sda3 sda4 sda5root@stm32mp1:~# ls /dev/sda*/dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sda5 |
Device mode
In Device mode, the PanGu development board can be used as a slave device to connect to the ports of other USB master devices.
Next, a memory device is connected to the USB host device port as a storage device. The host device can access this removable storage device.
# mkfs.vfat /dev/ram0# modprobe g_mass_storage file=/dev/ram0 removable=1 iSerialNumber="1234" |