Page tree
Skip to end of metadata
Go to start of metadata

PanGu开发板上提供了一个Micro USB OTG接口,默认为Host模式。

Host模式

直接使用Micro USB转USB Type A转换线缆,连接U盘至开发板即可,开发板会自动识别USB设备。U盘的分区格式支持FAT32, EXT4。以下例子中,插入了一个USB读卡器,读卡器上的SD有5个分区。

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 disk

root@stm32mp1:~# ls /dev/sda
sda   sda1  sda2  sda3  sda4  sda5
root@stm32mp1:~# ls /dev/sda*
/dev/sda  /dev/sda1  /dev/sda2	/dev/sda3  /dev/sda4  /dev/sda5


Device模式

Device模式下,PanGu开发板可作为从设备,连接至其它USB主设备的端口。

下面将一个内存设备以存储设备的方式连接至USB主控设备端口,主控设备上可以访问这个可移动存储设备。

# mkfs.vfat /dev/ram0
# modprobe g_mass_storage file=/dev/ram0 removable=1 iSerialNumber="1234"
  • No labels