Zynq Standalone USB device driver


Zynq Standalone USB device driver


Introduction

This page gives overview of Zynq usbps driver which available as part of the Xilinx Vivado and SDK distribution

How to enable

Source path for the driver:

https://gitenterprise.xilinx.com/embeddedsw/embeddedsw/tree/master/XilinxProcessorIPLib/drivers/usbps/


Driver source code is organized into different folders. Below diagram shows the usbpsu driver source organization

usbps
|
-- Doc - Provides the API and data structure details
|
- Examples - Reference application to show how to use the driver APIs and calling sequence
|
- Source - Driver source files

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 standalone driver
  • OTG mode is not supported by standalone driver

Performance



Test Procedure

Mass storage gadget

Mass 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.
Audio gadget
Audio profile can be tested by compiling 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 and xusbps_audiodata.h files.
Audio example supports either UAC1.0 or UAC2.0.By default audio example runs on UAC1.0.
To enable UAC2.0 support, undefine MACRO  XUSBPS_UAC1 in xusbps_ch9_audio.h.    

USB 2.0 Peripheral Mode
The below gives the testing procedure of zynq USB standalone example which operates as mass storage and 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.


Expected Output

Mass storage gadget

  • You will get pop-up window on Window machine for formatting the size 256MBAfter format complete you can copy a file to the USB device


Audio gadget

  1. 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

      2. Audio UAC2.0 Output:

  • 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>


Change Log


2017.1
Summary:
  • Added doxygen changes

2017.2
Summary:
  • None

2017.3
Summary:
  • None

2017.4
Summary:
  • None

2018.1
Summary:
  • None

2018.2
Summary:
  • None

2018.3
Summary:

  • None

2019.1
Summary:

  • None

2019.2
Summary:

  • None

2020.1
Summary:

  • Add USB ISO support
  • Add USB Audio example

Commits:

419d1a7

8593cd8

2020.2
Summary:

  • None