Table of Contents |
---|
Introduction
This page gives an overview of the Zynq usbps driver which available as part of the Xilinx Vivado and SDK distributionFor more information,
Please refer to Chapter 15: USB3.0 Controller in Zynq7000 TRM
Driver Sources
The source code for the driver is included with the Vitis Unified Software Platform installation and being available in the Xilinx Github repository.
Driver Name | Path in Vitis | Path in Github |
---|---|---|
usbps | <Vitis Install Directory>/data/embedded/XilinxProcessorIPLib/drivers/usbps | https://github.com/Xilinx/embeddedsw/tree/master/XilinxProcessorIPLib/drivers/usbps |
Note: To view the sources for a particular release, use the rel-version tag in github. For example, for the 2020.1 release, the proper version of the code is: https://github.com/Xilinx/embeddedsw/tree/master/XilinxProcessorIPLib/drivers/usbps
The driver source code is organized into different folders. The table below shows the usbps driver source organization.
Directory | Description |
---|---|
doc | Provides the API and data structure details |
data | Driver .tcl and .mdd file |
examples | Example applications that show how to use the driver features |
src | Driver source files |
Driver Implementation
For a full list of features supported by this IP,
Please refer to Chapter 15: USB3.0 Controller in Zynq7000 TRM
Features Supported
Controller Features Supported
- USB 2.0 High Speed Host controller (480 Mb/s).
- USB 2.0 HS and FS Device controller.
- USB 1.1 legacy FS/LS.
- On-the-Go, OTG 1.3 supplement.
- Local DMA Engine.
Features Driver support
- Support device mode only
Known Issues and Limitations:
- Host mode is not supported by the standalone driver
- OTG mode is not supported by the standalone driver
Example Applications
Refer to the driver examples directory for various example applications that exercise the different features of the driver. Each application is linked in the table below. The following sections describe the usage and expected output of the various applications.
These example applications can be imported into the Vitis IDE from the Board Support Package settings tab.
Links to Examples
Examples Path:
https://github.com/Xilinx/embeddedsw/tree/master/XilinxProcessorIPLib/drivers/usbps/examples
Test Name | Example Source | Description |
---|---|---|
USB Mass-Storage Gadget - Interrupt Mode | This example does a basic read and writes test from the USB drive in interrupt mode. | |
USB Audio Gadget | xusbps_audio_example.c | This example supports two audio features in audio mode: 1. Audio UAC1.0 and 2. Audio UAC2.0 |
Example | Depandent source files (https://github.com/Xilinx/embeddedsw/tree/master/XilinxProcessorIPLib/drivers/usbps/examples) |
---|---|
xusbps_intr_example.c | xusbps_class_storage.c,xusbps_class_storage.h,xusbps_ch9_storage.c,xusbps_ch9_storage.h,xusbps_ch9.c,xusbps_ch9.h |
xusbps_audio_example.c | xusbps_ch9_audio.c,xusbps_ch9_audio.h,xusbps_ch9.c,xusbps_ch9.h,xusbps_class_audio.c,xusbps_class_audio.h,xusbps_audiodata.h |
Example Application Usage
USB 2.0 Peripheral Mode
Mass-Storage: USB Interrupt mode example
Mass storage profile can be tested by compiling xusbps_class_storage.c,xusbps_class_storage.h,xusbps_ch9_storage.c,xusbps_ch9_storage.h,xusbps_ch9.c,xusbps_ch9.h and xusbps_intr_example.c
files together
Test Procedure
Mass storage gadgetMass storage profile can be tested by compiling xusbps_intr_example.c, xusbpsu_ch9.c, xusbpsu_ch9.h, xusbps_ch9_storage.c, xusbps_ch9_storage.h ,xusbps_class_storage.h and xusbps_class_storage.c files.
USB 2.0 Peripheral Mode
Testing procedure
- Download and run the generated USB 2.0 example ELF
- Connect board setup to standard host(Windows/Linux)machine USB 2.0 port.
Expected Output
Mass storage gadget
- You will get a pop-up window on the Window machine for formatting the size 256MB
After the format complete you can copy a file to the USB device
Audio gadget
Testing procedure
- Download and run the generated USB 2.0 example ELF
- Connect board setup to standard host(Windows/Linux)machine USB 2.0 port.
- To enable UAC2.0 support, undefine MACRO XUSBPS_UAC1 in xusbps_ch9_audio.h.
Expected Output
- Audio UAC1.0 output
- Detection of HighSpeed Microphone – UAC1.0 on standard host Linux machine USB 2.0 port.
bash-3.2$ dmesg [288542.092251] usb 3-5: new high-speed USB device number 67 using xhci_hcd [288542.238282] usb 3-5: New USB device found, idVendor=03fd, idProduct=0200 [288542.238284] usb 3-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [288542.238285] usb 3-5: Product: USB2.0 AUDIO [288542.238286] usb 3-5: Manufacturer: XILINX [288542.238287] usb 3-5: SerialNumber: 000000017150426200574 [288542.277249] usb 3-5: Warning! Unlikely big volume range (=468), cval->res is probably wrong. [288542.277251] usb 3-5: [3] FU [Mic Capture Volume] ch = 1, val = 8000/30464/48 [288542.311304] usb 3-5: Warning! Unlikely big volume range (=468), cval->res is probably wrong. [288542.311306] usb 3-5: [3] FU [Mic Capture Volume] ch = 1, val = 8000/30464/48 bash-3.2$ bash-3.2$ arecord -l **** List of CAPTURE Hardware Devices **** card 1: AUDIO [USB2.0 AUDIO], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 bash-3.2$ bash-3.2$ arecord -D hw:1,0 -f S16_LE -r 8000 -c 1 output1.wav -d 2 Recording WAVE 'output1.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono bash-3.2$ bash-3.2$ hexdump output1.wav -n 600 0000000 4952 4646 7d24 0000 4157 4556 6d66 2074 0000010 0010 0000 0001 0001 1f40 0000 3e80 0000 0000020 0002 0010 6164 6174 7d00 0000 0100 0302 0000030 0504 0706 0908 0b0a 0d0c 0f0e 1110 1312 0000040 1514 1716 1918 1b1a 1d1c 1f1e 2120 2322 0000050 2524 2726 2928 2b2a 2d2c 2f2e 0100 0302 0000060 0504 0706 0908 0b0a 0d0c 0f0e 2120 2322 0000070 2524 2726 2928 2b2a 2d2c 2f2e 3130 3332 0000080 3534 3736 3938 3b3a 3d3c 3f3e 4140 4342 0000090 4544 4746 4948 4b4a 4d4c 4f4e 5150 5352 00000a0 5554 5756 5958 5b5a 5d5c 5f5e 6160 6362 00000b0 6564 6766 6968 6b6a 6d6c 6f6e 7170 7372 00000c0 7574 7776 7978 7b7a 7d7c 7f7e 8180 8382 00000d0 8584 8786 8988 8b8a 8d8c 8f8e 9190 9392 00000e0 9594 9796 9998 9b9a 9d9c 9f9e a1a0 a3a2 00000f0 a5a4 a7a6 a9a8 abaa adac afae b1b0 b3b2 0000100 b5b4 b7b6 b9b8 bbba bdbc bfbe c1c0 c3c2 0000110 c5c4 c7c6 c9c8 cbca cdcc cfce d1d0 d3d2 0000120 d5d4 d7d6 d9d8 dbda dddc dfde e1e0 e3e2 0000130 e5e4 e7e6 e9e8 ebea edec efee f1f0 f3f2 0000140 f5f4 f7f6 f9f8 fbfa fdfc fffe 0100 0302 0000150 0504 0706 0908 0b0a 0d0c 0f0e 1110 1312 0000160 1514 1716 1918 1b1a 1d1c 1f1e 2120 2322 0000170 2524 2726 2928 2b2a 2d2c 2f2e 3130 3332 0000180 3534 3736 3938 3b3a 3d3c 3f3e 4140 4342 0000190 4544 4746 4948 4b4a 4d4c 4f4e 5150 5352 00001a0 5554 5756 5958 5b5a 5d5c 5f5e 6160 6362 00001b0 6564 6766 6968 6b6a 6d6c 6f6e 7170 7372 00001c0 7574 7776 7978 7b7a 7d7c 7f7e 8180 8382 00001d0 8584 8786 8988 8b8a 8d8c 8f8e 9190 9392 00001e0 9594 9796 9998 9b9a 9d9c 9f9e a1a0 a3a2 00001f0 a5a4 a7a6 a9a8 abaa adac afae b1b0 b3b2 0000200 b5b4 b7b6 b9b8 bbba bdbc bfbe c1c0 c3c2 0000210 c5c4 c7c6 c9c8 cbca cdcc cfce d1d0 d3d2 0000220 d5d4 d7d6 d9d8 dbda dddc dfde e1e0 e3e2 0000230 e5e4 e7e6 e9e8 ebea edec efee f1f0 f3f2 0000240 f5f4 f7f6 f9f8 fbfa fdfc fffe 0100 0302 0000250 0504 0706 0908 0b0a 0000258 |
---|
- UAC2.0 - Audio device detection and record/play an audio file from Host
- Check device entry with help of “aplay -l” or “arecord –l”
card 1: AUDIO [USB2.0 AUDIO], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 |
---|
- First, play a file with help of “aplay” command
- host # aplay -v -D hw:1,0 -f S16_LE -r 48000 -c 2 <uac2_0_play.wav>
- Record a file with help of “arecord” command
- host # arecord -v -D hw:1,0 -f S16_LE -c 2 -r 44100 -d 10 <uac2_0_record.wav>
...