USB Hub (SBC-i.MX51)

From BlueWiki

Jump to: navigation, search

The SBC-i.MX51 provides a USB hub connected to USB Host 1 of the i.MX processor.

V1.2: 4-port hub

V2.1: 7-port hub, 2 ports on the extension connector

1 Kernel configuration

Device Drivers  --->
  [*] USB support  --->
    <*>   Support for Host-side USB
    -*-     USB selective suspend/resume and wakeup
    <*>     EHCI HCD (USB 2.0) support
    [*]       Support for Freescale controller
    [*]         Support for Host1 port on Freescale controller
    [*]   Root Hub Transaction Translators

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

For HIDs, like USB mouse and keyboard:

Device Drivers  --->
  [*] HID Devices  --->  
    -*-   Generic HID support
    <*>   USB Human Interface Device (full HID) support  

2 Test in Linux

We will create a partition on a USB flash disk, write a random file to it and read it back.

  • Connect a USB flash disk to one of the 4 USB-A jacks.
  • Linux will automatically detect the new device:
usb 1-1.4: new high speed USB device using fsl-ehci and address 3
usb 1-1.4: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 3
usb-storage: waiting for device to settle before scanning
scsi 0:0:0:0: Direct-Access     Corsair  Flash Voyager    1100 PQ: 0 ANSI: 0 CCS
sd 0:0:0:0: [sda] 7831552 512-byte hardware sectors: (4.00 GB/3.73 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] 7831552 512-byte hardware sectors: (4.00 GB/3.73 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
usb-storage: device scan complete

We assume that the new device corresponds to the device file /dev/sda from now on.

  • Create single partition:
fdisk /dev/sda
p (prints partition table)
d (deletes existing partitions) ...repeat until no partitions exist
n (adds a new parition) ...select maximum size
w (writes partition table and exits)
  • Make ext3 file system and mount it:
mkfs.ext3 /dev/sda
mkdir /mnt/usbdisk
mount /dev/sda1 /mnt/usbdisk
  • Create random file:
dd if=/dev/urandom of=/randomfile bs=10M count=1
  • Copy random file to USB disk and unmount card:
cp /randomfile /mnt/usbdisk
umount /mnt/usbdisk
  • Mount USB disk again and check randomfile:
mount /dev/sda1 /mnt/sdcard
diff /mnt/usbdisk/randomfile /randomfile

diff must not output anything, which means the files are 100% identical.

Personal tools