2.9.5. USB

2.9.5.1. USB Design on EVMs

The USB module on AM64x has a dual-role USB controller. It works in host mode when the USB ID pin is grounded, or in device mode (also called peripheral mode) when the USB ID pin is float.

The USB ID pin could be permanently grounded on the board to design it as a host-only port, or routed to the USB micoro-AB receptacle and controlled by the USB cable plugged in. In the latter case, the USB port works in host mode when a micro-A cable is attached, or in device mode when a micro-B cable is attached.

AM64x GPEVM has one USB port with a USB2.0 micro-AB receptacle. It works in host-only mode when a jumper is placed on J23 (next to the USB receptacle) to ground the USB ID pin. Or the USB port works in dual-role mode when jumper J23 is open.

AM64x StartKit (SKEVM) has one USB port with a USB3.0 USB-A receptable. It works in host-only mode.

2.9.5.2. Examining USB Host Mode

USB Related Console Log

During Linux booting on the EVM which has a USB port configured in host mode, the following log should be observed on the Linux console, which indicates the USB host driver is loaded.

[   29.001328] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[   29.037632] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[   29.186767] xhci-hcd xhci-hcd.0.auto: hcc params 0x200073c9 hci version 0x100 quirks 0x00000020000 10010
[   29.305453] xhci-hcd xhci-hcd.0.auto: irq 365, io mem 0x0f410000
[   29.449651] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.10
[   29.590975] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   29.859185] usb usb1: Product: xHCI Host Controller
[   29.928979] usb usb1: Manufacturer: Linux 5.4.106-g023faefa70 xhci-hcd
[   30.086734] usb usb1: SerialNumber: xhci-hcd.0.auto
[   30.317787] hub 1-0:1.0: USB hub found
[   30.492891] hub 1-0:1.0: 1 port detected
[   30.637439] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[   30.725167] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[   30.785456] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0 SuperSpeed
[   30.846347] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[   30.884085] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.10
[   30.906256] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   30.957901] usb usb2: Product: xHCI Host Controller
[   31.033270] usb usb2: Manufacturer: Linux 5.4.106-g023faefa70 xhci-hcd
[   31.108026] usb usb2: SerialNumber: xhci-hcd.0.auto
[   31.125249] hub 2-0:1.0: USB hub found
[   31.157871] hub 2-0:1.0: 1 port detected

The command lsusb can also be used to check if the USB host mode is ready to use. For example,

# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Note

The lsusb command log above shows the logical USB buses. Though 3.0 root hub is listed, it doesn’t mean that the USB port supports USB super-speed. Please check the USB capability in the device TRM.

Enumerating USB Device

To plug in a USB device to a USB host port which has micro-AB receptacle, a USB microA-to-typeA adapter, as shown in the picture below, should be used.

usb to microAB male adapter

Once a USB device is plugged in, the Linux console by default shows USB enumeration messages. The following is an example of the message when a USB2.0 thumb drive is attached.

[ 5855.252039] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[ 5855.407252] usb 1-1: New USB device found, idVendor=8564, idProduct=4000, bcdDevice= 0.3a
[ 5855.415447] usb 1-1: New USB device strings: Mfr=3, Product=4, SerialNumber=5
[ 5855.423540] usb 1-1: Product: Transcend
[ 5855.428127] usb 1-1: Manufacturer: TS-RDF5
[ 5855.432971] usb 1-1: SerialNumber: 000000000037
[ 5855.475114] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 5855.481893] scsi host0: usb-storage 1-1:1.0
[ 5855.486956] usbcore: registered new interface driver usb-storage
[ 5856.517750] scsi 0:0:0:0: Direct-Access     TS-RDF5  SD  Transcend    TS3A PQ: 0 ANSI: 6
[ 5856.846809] sd 0:0:0:0: [sda] 15523840 512-byte logical blocks: (7.95 GB/7.40 GiB)
[ 5856.855366] sd 0:0:0:0: [sda] Write Protect is off
[ 5856.866184] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 5856.899954]  sda: sda1 sda2
[ 5856.916237] sd 0:0:0:0: [sda] Attached SCSI removable disk

The Processor SDK Linux automatically mounts USB block devices. To check the mounting points of the enumerated USB thumb drive, use df command:

# df | grep sda
/dev/sda2                 7497892   1366420   5730884  20% /run/media/sda2
/dev/sda1                   76630      1876     74754   3% /run/media/sda1

This example shows the two partitions of the USB thumb drive are mounted at /run/media/sda1 and /run/media/sda2 respectively. Now many Linux commands can be used to access the contents in the partitions. For example,

# ls /run/media/sda1
tiboot3.bin  tispl.bin  u-boot.img  uEnv.txt