USB Host (CM-i.MX27)

Aus BECOM Systems Support
Version vom 22. August 2023, 20:35 Uhr von en>Peter (1 Version importiert)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

The DEV-i.MX27/35 contains two USB host ports. Host 1 of the i.MX27 uses the integrated USB PHY of the MC13783 PMIC. It is capable of low and full speeds only. Host 2 uses an ULPI USB PHY on the DEV board.

Host 1

Kernel configuration

Device Drivers  --->
  USB support  --->
    <*>   Support for Host-side USB
    [*]   USB device filesystem
    <M>     EHCI HCD (USB 2.0) support
    [*]       Support for Freescale controller
    [*]         Support for Host1 port on Freescale controller
    [*]         Freescale MC13783 on Host 1
    [*]     Root Hub Transaction Translators (EXPERIMENTAL)

For mass storage devices, like USB flash disks:

Device Drivers  --->
  SCSI device support  --->
    <*> SCSI device support
    [*] legacy /proc/scsi/ support
    <*> SCSI disk support
    [*] Probe all LUNs on each SCSI device
  [*] USB support  --->
    <*>   USB Mass Storage support

Test in Linux

We will write a random file to a USB flash disk and read it back.

  • In Linux, load the required kernel modules:
root@btmxc27:~# modprobe isp1504_arc (necessary if you have also enabled USB-OTG)
driver fsl_arc, Revision: 1.0
root@btmxc27:~# modprobe ehci-hcd
fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.0: irq 54, io mem 0x10024200
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: Product: Freescale On-Chip EHCI Host Controller
usb usb1: Manufacturer: Linux 2.6.22-btmxc27-v1.0 ehci_hcd
usb usb1: SerialNumber: fsl-ehci.0
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
fsl-ehci fsl-ehci.1: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.1: new USB bus registered, assigned bus number 3
fsl-ehci fsl-ehci.1: irq 56, io mem 0x10024000
fsl-ehci fsl-ehci.1: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb3: Product: Freescale On-Chip EHCI Host Controller
usb usb3: Manufacturer: Linux 2.6.22-btmxc27-v1.0 ehci_hcd
usb usb3: SerialNumber: fsl-ehci.1
usb usb3: configuration #1 chosen from 1 choice
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 1 port detected
root@btmxc27:~# 
  • Connect a USB flash disk to the USB-A jack marked USB-H1 on the DEV board. Linux will automatically detect the new device, and

it tells you that the device may perform faster (if it is high-speed capable):

root@btmxc27:~# usb 1-1: new full speed USB device using fsl-ehci and address 2
usb 1-1: not running at top speed; connect to a high speed hub
usb 1-1: Product: FlashPen
usb 1-1: Manufacturer: Hama
usb 1-1: SerialNumber: 06F1055071610ACB
usb 1-1: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
scsi 0:0:0:0: Direct-Access     Hama     FlashPen         1.04 PQ: 0 ANSI: 0 CCS
sd 0:0:0:0: [sda] 501760 512-byte hardware sectors (257 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] 501760 512-byte hardware sectors (257 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
FAT: invalid media value (0xb9)
VFS: Can't find a valid FAT filesystem on dev sda.
  • If a valid file system is found on the flash disk, it is automatically mounted:
root@btmxc27:/# mount
...
/dev/sda1 on /media/sda1 type vfat (rw,sync,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1)
...
  • Create random file with 1 MiB, make md5sum:
root@btmxc27:~# dd if=/dev/urandom of=/testfile bs=1M count=1
1+0 records in
1+0 records out
root@btmxc27:~# md5sum /testfile 
a51ce1446ae266a0ec7fe99cc5d2d7c4  /testfile
root@btmxc27:~# 
  • Copy random file to USB disk, unmount and re-mount, compare the md5sums:
root@btmxc27:~# cp /testfile /media/sda1/
root@btmxc27:~# umount /media/sda1/
root@btmxc27:~# mount /dev/sda1 /media/sda1/
root@btmxc27:~# md5sum /media/sda1/testfile 
a51ce1446ae266a0ec7fe99cc5d2d7c4  /media/sda1/testfile
root@btmxc27:~# 

Now, we will connect a low-speed device, a USB mouse:

usb 1-1: new low speed USB device using fsl-ehci and address 3
usb 1-1: Product: USB-PS/2 Optical Mouse
usb 1-1: Manufacturer: Logitech
usb 1-1: configuration #1 chosen from 1 choice
input: Logitech USB-PS/2 Optical Mouse as /class/input/input1
input: USB HID v1.10 Mouse [Logitech USB-PS/2 Optical Mouse] on usb-fsl-ehci.0-1

Remarks

  • Because of an erratum of the i.MX27, it is possible that low speed USB devices refuse to work if they are connected through a hub. We could not verify this misbehavior.