USB Host Controller Driver
This IP core is no longer supported by Xilinx. This page is only left for a history. As of October 2011, Xilinx handed over to Missing Link Electronics sales and support. Please visit http://MLEcorp.com/USB for more details.
Table of Contents
This driver has been tested and is working. It is available from the Xilinx Public GIT server under linux-2.6-xilinx.git. For more information about git, please refer to Using Git
This driver works with the XPS USB Host controller core v1.00a, v1.01a, and v1.02a. It is a pay core, however, you can evaluate it for free.
Documentation The USB Host Controller core version v1.00.a is the High Speed (HS) only core. It supports HS devices through direct connect or through HS hubs.
Previous Documentation
To get the v1.02a evaluation version of the core:
- 1. Go to http://www.xilinx.com/support
- 2. Search answer record, 33609
- 3. In answer record 33609, at the bottom of the page, there is a link to the evaluation core.
- Or, you can follow this link, please note that you need to extract the core and put it in your EDK project directory, under the directory pcores/:
- ftp://ftp.xilinx.com/pub/applications/misc/xps_usb_host_v1_02_a_patch09232009.zip.
Linux USB Host controller Driver:
http://www.linux-usb.org/usb2.htmlDevice Tree Generator:
You need a device tree generator to generate the dts file for your kernel, from EDK. Please refer to [http://xilinx.wikidot.com/device-tree-generator device tree generator] page for more details. For explanation of the entries in the dts file, please refer to Documentation/powerpc/booting-without-of.txt inside Linux source tree.PHY:
The USB Host controller needs a PHY to communicate with USB devices. It should work with any ULPI PHYs. The PHY that we have been using for development on ML40X and ML50X boards is the SMSC daughter card:http://www.digilentinc.com/Products/Detail.cfm?Prod=EVB-USB3300-XLX&Nav1=Products&Nav2=Accessory
http://www.smsc.com/main/catalog/usb3300.html#Additional%20Information
Kernel Configuration
Please use "menuconfig" to configure the kernel. For ML507 board, we use "make ARCH=powerpc menuconfig" to configure the kernel. More general information on configuring, building, and loading the kernel for embedded systems can be found at Open Source Linux .
- Under "Device Drivers"
- Enable "USB Support"
- Enable "Support for Host-side USB"
- Enable "EHCI HCD (USB 2.0) support"
- Enable "Use Xilinx usb host EHCI controller core".
- (Optionally)Enable "USB verbose debug messages"
- (Optionally)Enable "USB announce new devices"
- (Optionally)Enable "USB device filesystem"
- Enable "EHCI HCD (USB 2.0) support"
- Enable "Support for Host-side USB"
- Enable "USB Support"
- If the USB host controller core is configured to support FS devices, then under "EHCI HCD (USB 2.0) support", enable "Root Hub Transaction Translators".
ML507 Testing Setup
The SMSC daughter card is connected to the ML507 board. The daughter card is plugged on the header closest to the power switch on the board with the daughter card hanging off the edge of the ML507. The jumpers of the SMSC daughter card should be as follows: J6=on (this makes the power come from the motherboard), J7=on, and no power is required for the SMSC daughter card. Please refer to usbhostsystemsetup for more detailed information on how to setup the connections using an ML505 or ML507 board.
After compiling the kernel using ELDK tools for PowerPC, load the kernel image to the ML507 board after programming the board. Following message is printed during kernel bootup, which indicates that the USB host controller has been initialized:
- xilinx-of-ehci 82400000.usb: new USB bus registered, assigned bus number 1
- xilinx-of-ehci 82400000.usb: irq 17, io mem 0x82400000
- xilinx-of-ehci 82400000.usb: USB 2.0 started, EHCI 1.00
- hub 1-0:1.0: USB hub found
- hub 1-0:1.0: 1 port detected
A USB device connects to the Host controller through the mini-AB connector on the SMSC daughter card.
Working with a USB Thumb Drive
Kernel Config to Support USB Thumb Drive
Please use "menuconfig" to configure the kernel. Since it is intended for an embedded system, "enable" means "built-in" (Not module).
- Under "Device Drivers"
- Under "USB Support"
- Enable "USB Mass Storage Support"
- (Optionally) Enable "USB Mass Storage verbose debug"
- Under "SCSI device support -->"
- Enable "SCSI disk support"
- Under "USB Support"
- Under "File systems"
- Under "DOS/FAT/NT Filesystems"
- Enable "VFAT (Windows-95) fs support"
- Change "Default codepage for FAT" to "850"
- Change "Default iocharset for FAT" to "iso8859-1"
- Under "Native language support"
- Enable "Codepage 850"
- Enable "Codepage ASCII"
- Enable "NLS ISO 8859-1"
- Enable "NLS UTF-8"
- Under "DOS/FAT/NT Filesystems"
Now compile the kernel for your system, and load the image to the board that has been programmed with XPS USB Host Controller.
Mounting the Thumb Drive
After Linux has boot up on your system, plug the thumb drive into the USB connector. The thumb drive will be enumerated, a message similar to the following one is shown on the console:
- root:~> usb 1-1: new high speed USB device using xilinx-of-ehci and address 2
- usb 1-1: New USB device found, idVendor=054c, idProduct=01f9
- usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
- usb 1-1: Product: Storage Media
- usb 1-1: Manufacturer: SONY
- usb 1-1: SerialNumber: 0C4C072904D1
- usb 1-1: configuration #1 chosen from 1 choice
- scsi0 : SCSI emulation for USB Mass Storage devices
- scsi 0:0:0:0: Direct-Access SONY Storage Media 1.00 PQ: 0 ANSI: 0 CCSsd 0:0:0:0: [sda] 492544 512-byte hardware sectors: (252 MB/240 MiB)
- 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] 492544 512-byte hardware sectors: (252 MB/240 MiB)
- sd 0:0:0:0: [sda] Write Protect is off
- sd 0:0:0:0: [sda] Assuming drive cache: write through
- sda:<7>usb-storage: queuecommand called
- sda1
- sd 0:0:0:0: [sda] Attached SCSI removable disk
To use the thumb drive, it has to be mounted to the Linux system, as following:
- mount -t vfat /dev/sda1 /media/usbdisk
Note:
- For the mount command to succeed, a directory called "/media/usbdisk" pre-exists.
- The device ID of "/dev/sda1" is dependent on the system, please check the printout when you plug your thumb drive into your system. For this example, the line "sda1" tells that the newly discovered device has device name of "/dev/sda1".
Using the Thumb Drive
Once the thumb drive has been successfully mounted, you can use it as a normal directory.Go to the Thumb Drive
The following commands change the directory to the thumb drive, and list the content of the thumb drive:- cd /media/usbdisk
- ls
Copy Files to/from the Thumb Drive, and Verify
The following commands copy files from your embedded system and then copy it back with a different name, then use "diff" command to compare the files:- cp /home/executable.elf /media/usbdisk/
- umount /media/usbdisk
- mount -t vfat /dev/sda1 /media/usbdisk
- cp /media/usbdisk/executable.elf /home/executable2.elf
- diff /home/executable.elf /home/executable2.elf
The "diff" command should report nothing different, which means the copies are successful.
Note:
- The "umount /media/usbdisk" and "mount -t vfat /dev/sda1 /media/usbdisk" commands ensure the copy goes through to the thumb drive, and the read later is from the thumb drive, instead of temporary buffers in the system.
Disconnect the Thumb Drive
Since disconnecting the thumb drive during transfers can corrupt data on the thumb drive, it is safer to issue following command before disconnecting the thumb drive:- umount /media/usbdisk
Wait until the flashing on the thumb drive finishes, and then you can safely disconnect the thumb drive.
Working with the USB Host Controller with Full Speed Support
The USB Host Controller core version 1.01a and v1.02a have Full Speed(FS) support, now we can finally connect USB speakers and USB microphones for some music fun! Note that you can configure the hardware to be High Speed (HS) only, or HS/FS hybrid. The HS only configuration works as before, this section discusses how to use the HS/FS configuration. Be aware that most commercial USB speakers, USB microphones, or USB headphones are FS devices.The only difference of using the HS/FS configuration is that you have to enable "Transaction Translator".
- Under "Device Drivers"
- Enable "USB Support"
- Enable "Support for Host-side USB"
- Enable "EHCI HCD (USB 2.0) support"
- Enable "Root Hub Transaction Translators"
- Enable "EHCI HCD (USB 2.0) support"
- Enable "Support for Host-side USB"
- Enable "USB Support"
Working with USB Microphones and USB Speakers
This would be a little bit involved on software side, because of the libraries you need to put into your Linux system. How to do that is beyond the scope of this documentation. Please refer to internet for information on how to setup that. We use a full-fledged root filesystem, that is put onto a Flash Card (with Xilinx SysACE support in Linux Kernel).
In this section, we do not have a fancy player to charge along with the microphone and speakers. You can certainly find one for your system for better sound quality control.
We use the following audio devices for our audio testing, they are all well supported by Linux:
- Logitech Quickcam pro 9000 (HS audio IN)
- Logitech desktop microphone (FS audio IN)
- Insignia notebook speakers NS-NBSPK2 (FS audio OUT)
Linux Configuration to Enable USB Microphones and USB Speakers
The support for USB audio devices is under the "Sound card support" section inside "Device drivers".
- Under "Device Drivers"
- Under "Sound card support"
- Enable "Advanced Linux Sound Architecture" (ALSA)
- Enable "OSS Mixer API"
- Enable "OSS PCM (digital audio) API"
- Enable "OSS PCM (digital audio) API - Include plugin system"
- (optional) Enable "Support old ALSA API"
- (optional) Enable "Verbose procfs contents"
- Enable "USB sound devices"
- Select "USB Audio/MIDI driver"
- Enable "Advanced Linux Sound Architecture" (ALSA)
- Under "Sound card support"
Using USB Microphone
Plug in your USB microphone, check your /dev/ directory for newly discovered devices (note: you need udev support for this, otherwise, you can statically mknod for your audio devices in the /dev/ directory.). We assume it is /dev/audio.
A simple way to record your audio through microphone is using the "cat" command and pipe it to a file:
- cat /dev/audio > ~/myaudio
Using USB Speakers
As using the USB microphone, playing music through the USB speakers is through the "cat" command too. We assume your speakers come up as /dev/audio1:- cat ~/myaudio > /dev/audio1
Amazingly, the sound quality is good!
Related Links
- Wiki Page from Michal Simek- Has Guide on Building Linux for ML505 and Spartan Boards
- USB Host System Setup
- Linux USB Gadget Driver
- Linux Drivers
© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy