Difference between revisions of "USB Host"

From ArmadeusWiki
Jump to: navigation, search
(Forcing an OTG port to Host mode (APF27 / APF51 / APF28))
 
(53 intermediate revisions by 9 users not shown)
Line 1: Line 1:
How-To use the ISP176x USB Host controller of the APF9328DevFull
+
How-To use the USB Host functionnality of Armadeus boards under Linux.
  
The DevFull is equipped with a USB 2.0 Host controller featuring three USB high speed ports.<br>
+
== Controller ==
 +
* [[APF9328DevFull|APF9328DevFull]]: it is equipped with a USB 2.0 Host controller (ISP1761) featuring three USB high speed ports. The ISP1761 driver is already configured with armadeus version 3. For older versions refer to the [[ISP1761_Linux_driver |how to install USB Host Linux driver for the DevFull]] page
 +
* [[APF27]] and [[APF27Dev]]: two Host ports are available. The controllers are integrated in the i.MX27 processor. Nothing has to be done to configure the controller. No special operation has to be done to use both USB ports (driver is included in default kernel).
 +
* [[APF27 PPS]]: one Host port and one OTG port (that can be forced to Host mode). Default Linux kernel has all the needed drivers compiled in.
 +
* [[APF51Dev]]: 2 Host ports and one OTG port (that can be forced to Host mode). Default Linux kernel has all the needed drivers compiled in.
 +
* [[PPS51]] one Host port and one OTG port (that can be forced to Host mode). Default Linux kernel has all the needed drivers compiled in.
 +
* [[APF28Dev]]: one Host port and one OTG port (Host/slave mode automatically switched depending on cable). Default Linux kernel has all the needed drivers compiled in.
  
= USB HOST Controller =
+
== Forcing an OTG port to Host mode ([[APF27]] / [[APF51]] / [[APF28]])==
== Driver installation ==
+
* If you don't have an OTG compatible cable or an old APFDev board (ex: APF28Dev Rev 1), it might be needed to force Host mode on OTG port:
make linux-menuconfig
+
<pre class="apf">
 +
BIOS> setenv extrabootargs ${extrabootargs} otg_mode=host
 +
BIOS> saveenv
 +
BIOS> boot
 +
</pre>
  
select Device Driver->USB support->support for Host-side USB (kernel)<br>
+
== Using USB devices ==
select Device Driver->Armadeus Specific Drivers->ISP1761 USB 2.0 Host controller (module)
+
  
== Starting the drivers ==
+
=== USB keyboard/mouse (HID: Human Interface Device) ===
Three drivers have to be started in order to get the ISP working.
+
==== Driver installation ====
They have to be started in the following order:
+
* [[Talk:USB_Host|Done by default]] in recent releases
modprobe apf9328-isp1761
+
modprobe hal_imx
+
modprobe pehci
+
  
= USB devices =
+
====Plug the keyboard====
 +
* you should see on console (here on APF9328 for example):
 +
<pre class="apf">
 +
usb 1-1.1: new low speed USB device using isp1761 and address 3
 +
usb 1-1.1: configuration #1 chosen from 1 choice
 +
input: NOVATEK USB Keyboard as /class/input/input0
 +
input: USB HID v1.10 Keyboard [NOVATEK USB Keyboard] on usb-platform-1.1
 +
input: NOVATEK USB Keyboard as /class/input/input1
 +
input: USB HID v1.10 Mouse [NOVATEK USB Keyboard] on usb-platform-1.1
 +
</pre>
 +
* To change keyboard keymap (by default US one is used):
 +
<pre class="apf">
 +
# loadkmap < /etc/i18n/fr.kmap
 +
</pre>
  
== USB keyboard ==  
+
====Plug the mouse====
=== driver installation ===
+
* you should see on console (here on APF9328 for example):
Adding USB keyboard support
+
<pre class="apf">
  make linux-menuconfig
+
usb 1-1.2: new low speed USB device using isp1761 and address 6
  select Device Driver->HID Devices-> Generic HID support (kernel)<br>
+
  usb 1-1.2: configuration #1 chosen from 1 choice
  select Device Driver->HID Devices-> USB Human Interface Device (module)
+
  input: Logitech USB-PS/2 Optical Mouse as /class/input/input6
=== Starting the driver ===
+
  input: USB HID v1.10 Mouse [Logitech USB-PS/2 Optical Mouse] on usb-platform-1.2
modprobe usbhid
+
</pre>
  
== USB Flash memory ==  
+
=== USB Flash memory / USB key / USB card reader / USB Hard Drive===  
=== driver installation ===
+
==== Driver installation ====
Adding USB Flash support
+
* [[Talk:USB_Host|Done by default]] in recent releases.
make linux-menuconfig
+
select Device Driver-> SCSI device support->SCSI device support (kernel)<br>
+
select Device Driver-> SCSI device support->legacy /proc/scsi/ support (kernel)<br>
+
select Device Driver-> SCSI device support->SCSI disk support (kernel)<br>
+
  
select Device Driver-> USB support ->USB device filesystem (kernel)<br>
+
==== Plug the storage device ====
  select Device Driver-> USB support ->USB Mass Storage support (kernel)<br>
+
* You should see (for example):
 +
<pre class="apf">
 +
  usb 1-1.2: new high speed USB device using isp1761 and address 6
 +
usb 1-1.2: configuration #1 chosen from 1 choice
 +
scsi0 : SCSI emulation for USB Mass Storage devices
 +
usb 1-1.2: reset high speed USB device using isp1761 and address 6
 +
scsi 0:0:0:0: Direct-Access    Hama    Card Reader  CF 1.9C PQ: 0 ANSI: 0 CCS
 +
sd 0:0:0:0: [sda] Attached SCSI removable disk
 +
</pre>
  
=== Starting the driver ===
+
==== Additional configuration ====
if sda1 has not been previoulsy created
+
* If /dev/sdaX does not exist, then create it:
  mknod /dev/sda1 b 8 1
+
<pre class="apf">
create a mount directory "memstick"
+
  # mknod /dev/sda b 8 0
  mkdir -m 777 /mnt/memstick
+
# mknod /dev/sda1 b 8 1
mount the USB Flash device
+
# mknod /dev/sda2 b 8 2
mount -t vfat /dev/sda1 /mnt/memstick
+
</pre>
check what is present on the USB Flash device
+
* Create a mount directory "usbdisk"
ls -al /mnt/memstick
+
<pre class="apf">
 +
  # mkdir -m 777 /mnt/usbdisk
 +
</pre>
  
 +
==== Mount the device ====
 +
* Mount the USB Mass Storage device
 +
<pre class="apf">
 +
# mount -t vfat /dev/sda1 /mnt/usbdisk
 +
</pre>
 +
* Check what is present on the USB Mass Storage device:
 +
<pre class="apf">
 +
# ls -al /mnt/usbdisk
 +
</pre>
 +
* And if it is well mounted (for example):
 +
<pre class="apf">
 +
# mount
 +
rootfs on / type rootfs (rw)
 +
/dev/root on / type jffs2 (rw)
 +
proc on /proc type proc (rw)
 +
devpts on /dev/pts type devpts (rw)
 +
tmpfs on /tmp type tmpfs (rw)
 +
sysfs on /sys type sysfs (rw)
 +
/dev/sda1 on /mnt/usbdisk type msdos (rw,fmask=0022,dmask=0022,codepage=cp437)
 +
</pre>
  
= USB Performances =
+
=== USB <--> Serial adapters ===
A performance test has been performed by means of the usb_perf.sh script. <br>
+
* See [[USB_to_serial_adapter]]
A high speed USB stick (corsair memory flash voyager) has been used.
+
Test result (mean values): read -> 2980 kBytes/sec  write -> 2095 kBytes/sec
+
  
 +
=== USB <--> WiFi adapters ===
 +
* See [[USB_to_WiFi_adapter]]
  
 +
==U-Boot usage==
 +
USB storage can also be used with U-Boot. The following commands are useful:
  
 +
* start/restart the USB:
 +
<pre class="apf">
 +
BIOS> usb start
 +
</pre>
 +
* show available USB devices:
 +
<pre class="apf">
 +
BIOS> usb info
 +
</pre>
 +
* list the USB key content (mass storage only):
 +
<pre class="apf">
 +
BIOS> fatls usb 0
 +
</pre>
 +
* load the file xxx.bin in RAM:
 +
<pre class="apf">
 +
BIOS> fatload usb 0 ${loadaddr} xxx.bin
 +
</pre>
  
 
== Links ==
 
== Links ==
* http://www.nxp.com/acrobat_download/datasheets/ISP1761_4.pdf
+
* Any links ?
 +
 
 +
[[Category:BoardConnectivity]]
 +
[[Category:Linux drivers]]
 +
[[Category:USB]]

Latest revision as of 12:04, 23 April 2015

How-To use the USB Host functionnality of Armadeus boards under Linux.

Controller

  • APF9328DevFull: it is equipped with a USB 2.0 Host controller (ISP1761) featuring three USB high speed ports. The ISP1761 driver is already configured with armadeus version 3. For older versions refer to the how to install USB Host Linux driver for the DevFull page
  • APF27 and APF27Dev: two Host ports are available. The controllers are integrated in the i.MX27 processor. Nothing has to be done to configure the controller. No special operation has to be done to use both USB ports (driver is included in default kernel).
  • APF27 PPS: one Host port and one OTG port (that can be forced to Host mode). Default Linux kernel has all the needed drivers compiled in.
  • APF51Dev: 2 Host ports and one OTG port (that can be forced to Host mode). Default Linux kernel has all the needed drivers compiled in.
  • PPS51 one Host port and one OTG port (that can be forced to Host mode). Default Linux kernel has all the needed drivers compiled in.
  • APF28Dev: one Host port and one OTG port (Host/slave mode automatically switched depending on cable). Default Linux kernel has all the needed drivers compiled in.

Forcing an OTG port to Host mode (APF27 / APF51 / APF28)

  • If you don't have an OTG compatible cable or an old APFDev board (ex: APF28Dev Rev 1), it might be needed to force Host mode on OTG port:
BIOS> setenv extrabootargs ${extrabootargs} otg_mode=host
BIOS> saveenv
BIOS> boot

Using USB devices

USB keyboard/mouse (HID: Human Interface Device)

Driver installation

Plug the keyboard

  • you should see on console (here on APF9328 for example):
 usb 1-1.1: new low speed USB device using isp1761 and address 3
 usb 1-1.1: configuration #1 chosen from 1 choice
 input: NOVATEK USB Keyboard as /class/input/input0
 input: USB HID v1.10 Keyboard [NOVATEK USB Keyboard] on usb-platform-1.1
 input: NOVATEK USB Keyboard as /class/input/input1
 input: USB HID v1.10 Mouse [NOVATEK USB Keyboard] on usb-platform-1.1
  • To change keyboard keymap (by default US one is used):
 # loadkmap < /etc/i18n/fr.kmap

Plug the mouse

  • you should see on console (here on APF9328 for example):
 usb 1-1.2: new low speed USB device using isp1761 and address 6
 usb 1-1.2: configuration #1 chosen from 1 choice
 input: Logitech USB-PS/2 Optical Mouse as /class/input/input6
 input: USB HID v1.10 Mouse [Logitech USB-PS/2 Optical Mouse] on usb-platform-1.2

USB Flash memory / USB key / USB card reader / USB Hard Drive

Driver installation

Plug the storage device

  • You should see (for example):
 usb 1-1.2: new high speed USB device using isp1761 and address 6
 usb 1-1.2: configuration #1 chosen from 1 choice
 scsi0 : SCSI emulation for USB Mass Storage devices
 usb 1-1.2: reset high speed USB device using isp1761 and address 6
 scsi 0:0:0:0: Direct-Access     Hama     Card Reader   CF 1.9C PQ: 0 ANSI: 0 CCS
 sd 0:0:0:0: [sda] Attached SCSI removable disk

Additional configuration

  • If /dev/sdaX does not exist, then create it:
 # mknod /dev/sda b 8 0
 # mknod /dev/sda1 b 8 1
 # mknod /dev/sda2 b 8 2
  • Create a mount directory "usbdisk"
 # mkdir -m 777 /mnt/usbdisk

Mount the device

  • Mount the USB Mass Storage device
 # mount -t vfat /dev/sda1 /mnt/usbdisk
  • Check what is present on the USB Mass Storage device:
 # ls -al /mnt/usbdisk
  • And if it is well mounted (for example):
 # mount
 rootfs on / type rootfs (rw)
 /dev/root on / type jffs2 (rw)
 proc on /proc type proc (rw)
 devpts on /dev/pts type devpts (rw)
 tmpfs on /tmp type tmpfs (rw)
 sysfs on /sys type sysfs (rw)
 /dev/sda1 on /mnt/usbdisk type msdos (rw,fmask=0022,dmask=0022,codepage=cp437)

USB <--> Serial adapters

USB <--> WiFi adapters

U-Boot usage

USB storage can also be used with U-Boot. The following commands are useful:

  • start/restart the USB:
BIOS> usb start
  • show available USB devices:
BIOS> usb info
  • list the USB key content (mass storage only):
BIOS> fatls usb 0 
  • load the file xxx.bin in RAM:
BIOS> fatload usb 0 ${loadaddr} xxx.bin 

Links

  • Any links ?