USB AUDIO 2.0 REFERENCE DESIGN XMOS, USB AUDIO 2.0 REFERENCE DESIGN Datasheet

USB AUDIO 2.0 REFERENCE DESIGN

USB AUDIO 2.0 REFERENCE DESIGN

Manufacturer Part Number
USB AUDIO 2.0 REFERENCE DESIGN
Description
USB AUDIO 2.0 REFERENCE DESIGN
Manufacturer
XMOS

Specifications of USB AUDIO 2.0 REFERENCE DESIGN

Design Resources
USB AUDIO Schematic
Main Purpose
Audio, Audio Processing
Embedded
Yes
Utilized Ic / Part
XS1-L1
Primary Attributes
Audio data up to 24-bit @ 192kHz
Secondary Attributes
I²S and S/PDIF
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Other names
880-1017
USB Audio Software Design Guide
Document Revision 1.2
Publication Date: 2011/01/14
Copyright © 2011 XMOS Limited, All Rights Reserved.

Related parts for USB AUDIO 2.0 REFERENCE DESIGN

USB AUDIO 2.0 REFERENCE DESIGN Summary of contents

Page 1

... USB Audio Software Design Guide Publication Date: 2011/01/14 Copyright © 2011 XMOS Limited, All Rights Reserved. Document Revision 1.2 ...

Page 2

... In addition to a mix of components to build a USB audio application, XMOS provide two reference designs: USB Audio 2.0 Reference Design (XS1-L1) and the USB Audio 2.0 Multichannel Reference Design (XS1-L2). These are applications based on the USB audio framework with a particular qualified feature set and an accommpanying reference hardware platform ...

Page 3

... Supported Devices XMOS Devices Requirements Development Tools USB Audio Boot/Storage Licensing and Support Reference code provided without charge under license from XMOS. Contact support@xmos.com Reference code is maintained by XMOS Limited. USB 1.0 USB 2.0 USB Audio Class 1.0 [USBAud10] USB Audio Class 2.0 [USBAud20] USB Firmware Upgrade 1 ...

Page 4

... XMOS: http://www.xmos.com/products/development-kits/usbaudio2 The following diagram shows the block layout of the USB Audio 2.0 Reference Design board. The main purpose of the XS1- provide a USB audio interface to the USB PHY and route the audio to the audio CODEC and S/PDIF output. Note that although the software supports MIDI, there are no MIDI connectors on the board ...

Page 5

... USB Audio 2.0 Multichannel Hardware Reference Design (XS1-L2) The USB Audio 2.0 Multichannel Reference Design (XS-L2 hardware reference design available from XMOS: http://www.xmos.com/products/development-kits/usbaudio2mc The following diagram shows the block layout of the USB Audio 2.0 Multichannel Reference Design board. The board supports six analogue inputs, eight analogue outputs, digital input, digital output and MIDI ...

Page 6

... The following sections describe the system architecture of the XMOS USB Audio software platform. 3.1 The USB Audio 2.0 System Architecture The XMOS USB Audio 2.0 System consists of a series of communicating components. Every system has the following core components: Component XMOS USB Device Driver (XUD) Handles the low level USB I/O. ...

Page 7

USB Audio Software Design Guide Component Device Firmware (DFU) Mixer S/PDIF Transmitter S/PDIF Receiver ADAT Receiver Clockgen MIDI S/PDIF or ADAT input require use of the Clockgen component and an external clock generator for clock recovery. The following diagram shows ...

Page 8

... The USB Audio 2.0 Reference Design (XS1-L1) The USB Audio 2.0 Reference Design is an application of the USB audio framework specifically for the hardware described in Section XS1-L1 single core device (500MIPS). The software design supports two channels of ...

Page 9

USB Audio Software Design Guide Endpoint 0 Endpoint buffer Decoupler Audio Driver Device Firmware Upgrade (DFU) S/PDIF Transmitter or MIDI The following diagrams show the software layout of the code running on the XS1-L1 chip. Each unit runs in a ...

Page 10

USB Audio Software Design Guide 3.2.1 Port 32A Port 32A on the XS1- 32-bit wide port that has several separate signal bit signals connected to it, accessed by multiple threads. To this end, any output to this port ...

Page 11

USB Audio Software Design Guide L1-QFP128 Figure 6: Audio Clock Connections The reference design board uses a 24 bit, 192kHz stereo audio CODEC (Cirrus Logic CS4270). The CODEC is configured to operate in stand-alone mode meaning that no serial configuration ...

Page 12

USB Audio Software Design Guide double-speed mode and 64Fs in quad-speed mode. This allows an 11.2896MHz master clock to be used for sample rates of 44.1, 88.2 and 176.4kHz. With MDIV2 high, the master clock must be 512Fs in single-speed ...

Page 13

... USB Audio Software Design Guide XMOS USB Device Driver (XUD) Endpoint 0 Endpoint buffer Decoupler Audio Driver Device Firmware Upgrade (DFU) Mixer S/PDIF Transmitter S/PDIF Receiver ADAT Receiver Clockgen MIDI The following thread diagram shows the software layout of the USB Audio 2.0 Multichannel Reference Design ...

Page 14

USB Audio Software Design Guide stdcore[0] USB XUD stdcore[1] MIDI SPDIF IN Figure 7: L2 Reference Design Thread Layout 3.3.1 Clocking For complete clocking flexibilty the L2 reference design drives a reference clock to an external fractional-n ...

Page 15

USB Audio Software Design Guide 3.3.2 Validated Build Options The reference design can be built in several ways by changing the option described in 5.1. However, the design has only been validated against the build options as set in the ...

Page 16

... USB Audio Software Design Guide 3.4 USB Interface The low-level USB interface is controlled by the XMOS USB Device (XUD) driver. This driver is described in the XUD library documentation [Xud]. The low level USB interface is serviced by three threads: The Endpoint 0 thread controls the enumeration/configuration tasks of the USB device. The buff ...

Page 17

USB Audio Software Design Guide 3.4.2 Endpoint 0: Management and Control Endpoint 0 ( endpoint0.xc ) controls the management tasks of the USB device. These tasks can be split into enumeration, reset, audio configuration and firmware upgrade. When the host ...

Page 18

USB Audio Software Design Guide 1. Depending on the DFU state, the device may be set into DFU mode message is sent to the audio driver to alert impending reset. At this point audio capture/playback ...

Page 19

USB Audio Software Design Guide The decoupler supplies the USB buffering thread with buffers to trans- Decoupler mit/receive data from the host. It marshals these buffers into FIFOs. The data from the FIFOs are then sent over XC channels to ...

Page 20

USB Audio Software Design Guide Decoupler/Audio thread interaction system, the decoupler thread must respond to requests from the audio system to send/receive samples immediately. An interrupt handler is set up in the de- coupler thread to do this. The interrupt ...

Page 21

USB Audio Software Design Guide Decouple Audio System outuint() inuint() outuint() testct() inuint() inuint() inuint() inuint() ... outuint() outuint() outuint() outuint() ... Table 6: Decouple/Audio System Channel Communication 3.4.4 Aysnc Feedback The device uses a feedback endpoint to report the ...

Page 22

... Device Firmware Upgrade (DFU) The DFU interface handles updates to the boot image of the device. The interface links USB to the XMOS flash user library (see [ToolsUserGuide]). In Application mode the DFU can accept commands to reset the device into DFU mode. There are two ...

Page 23

... USB Audio Software Design Guide to the factory image. Note that the XMOS specific command request identifiers are defined in dfu_types.h within module_dfu . 3.6 Audio Driver The audio driver receives and transmits samples from/to the decoupler or mixer thread over an XC channel. It then drives several in and out I2S channels. If the fi ...

Page 24

USB Audio Software Design Guide Sample Rate (kHz) 44.1 88.2 176 192 Table 9: Clock Divides used in L1 Ref Design The master clock must be supplied by an external source eg. clock generator chip, fixed oscillators, PLL ...

Page 25

USB Audio Software Design Guide The code to configure the ports and clocks is in the Developers should not need to modify this. The L1 device inputs MCLK and divides it down to generate BCLK and LRCLK. To achieve this, ...

Page 26

USB Audio Software Design Guide 3.6.2 Changing Audio Sample Frequency When the host changes sample frequency, a new frequency is sent to the audio driver thread by Endpoint 0. First, a change of sample frequency is reported by sending the ...

Page 27

... SET_MIX_MAP SET_MIX_IN_VOL SET_MIX_OUT_VOL Table 11: Mixer Component Commands 3.7.2 Host Control The mixer can be controlled from a host PC. XMOS has a sample application showing how to control the mixer. For details, contact XMOS. Description Sets the source of one of the audio streams going to the host. Sets the source of one of the audio streams going to the audio driver ...

Page 28

USB Audio Software Design Guide 3.8 S/PDIF Transmit XS1 devices can support S/PDIF transmit up to 192kHz. The S/PDIF transmitter uses a lookup table to encode the audio data. It receives samples from the Audio thread two at a time, ...

Page 29

USB Audio Software Design Guide which introduces jitter of 2.5 the S/PDIF signal. A typical jitter-reduction scheme is an external D-type flip-flop clocked from the master clock (as shown in the preceding diagram). 3.8.2 Usage The interface is ...

Page 30

USB Audio Software Design Guide The channel status bits are 0x0nc07A4, where c=1 for left channel, c=2 for right channel and n indicates sampling frequency: 44.1 Frequency (kHz 3.9 S/PDIF Receive XS1 devices can support S/PDIF receive up ...

Page 31

USB Audio Software Design Guide See S/PDIF specification for futher details on format, user bits etc. 3.9.1 Integration The S/PDIF receive function communicates with the clockGen component with passes audio data to the audio driver and handles locking to the ...

Page 32

USB Audio Software Design Guide 3.10 ADAT Receive The ADAT component receives up to eight channels of audio at a sample rate of 44.1kHz or 48kHz. The API for calling the receiver functions is described in 5.3. The component outputs ...

Page 33

USB Audio Software Design Guide 3.11 Clock Recovery An application can either provide fixed master clock sources via selectable oscillators, clock generation IC, etc., to provide the audio master or use a exteral PLL/Clock Multiplier to generate a master clock ...

Page 34

USB Audio Software Design Guide Component Threads XUD library 1 Endpoint 0 1 USB Buffering 1 Audio driver 1 S/PDIF Tx 1 S/PDIF Rx 1 ADAT Rx 1 Midi 1 Mixer 2 ClockGen 1 These resource estimates are based on ...

Page 35

... USB audio applications. 4.1 Getting Started 4.1.1 Building with the XDE To install the software, open the XDE (XMOS Development Tools) and follow these steps: 1. Choose File Import. 2. Choose General Existing Projects into Workspace and click Next. 3. Click Browse next to Select archive fi ...

Page 36

... Browse for the XE file in the Project and C/XC Application boxes. 9. Ensure the XTAG-2 device appears in the adapter list. 10. Click Run. 4.1.5 Using Command Line Tools 1. Open the XMOS command line tools (Desktop Tools Prompt) and execute the following command: xflash <binary>.xe module_xmos_common . This system includes the source To upgrade the fi ...

Page 37

... S/PDIF receive code ADAT receive code MIDI I/O code Device Firmware Upgrade code Common build infrastructure Table 19: USB Audio Modules USB Audio 2.0 Reference Design code USB Audio 2.0 Multichannel Reference Design code app_usb_aud_l1 directory. The application uses 37/57 Document Revision 1.2 ...

Page 38

USB Audio Software Design Guide 2. A custom defines file: 3. Source code providing definitions of application support functions for the USB audio framework. 4. The application itself; in particular a top-level main function describing which components are run where ...

Page 39

... Audio Class 1.0 friendly freq */ #define DEFAULT_FREQ Finally, there are some general USB identification defines to be set. These are set for the XMOS reference design but vary per manufacturer: #define VENDOR_ID (0x20B1) /* XMOS VID */ #define PID_AUDIO_2 (0x0002 USB Audio Reference Design PID */ ...

Page 40

USB Audio Software Design Guide void CodecInit(chanend ?c_codec) { return sample rate changes, you need to reset the CODEC and set the relevant clock input from the two oscillators on the board. Both the CODEC reset line and ...

Page 41

USB Audio Software Design Guide void CodecConfig(unsigned samFreq, unsigned mClk, chanend ?c_codec) { timer t; unsigned time; unsigned portVal; unsigned tmp; /* Put codec in reset and set master clock select appropriately */ if ((samFreq % 22050 ...

Page 42

USB Audio Software Design Guide an external PLL chip: /* These functions must be implemented for the clocking arrangement of specific design */ void ClockingInit For L1 reference */ } void ClockingConfig(unsigned mClkFreq For L1 reference ...

Page 43

USB Audio Software Design Guide #include "port32A.h" /* Functions that handle functions that must occur on stream * start/stop e.g. DAC mute/un-mute. * These need implementing for a specific design Implementations for the L1 USB Audio Reference Design ...

Page 44

USB Audio Software Design Guide This is a single core program so all threads are on the same core. For a multicore program different threads can be placed on different cores using the syntax. The first thread run is the ...

Page 45

USB Audio Software Design Guide These then connect to the audio driver which controls the I2S output and S/PDIF output (if enabled). If S/PDIF output is enabled, this component spawns into two threads as opposed to one. audio(c_mix_out, null, null); ...

Page 46

... To do this you need to alter the main audio driver loop in alteration you need to re-test the functionality. The XMOS Timing Analyzer can help guarantee that your changes do not break the timing requirement of this thread. ...

Page 47

USB Audio Software Design Guide 5 API 5.1 Custom Defines An application using the USB audio framework needs to have a defines file called customedefines.h . This file can set the following defines: 47/57 Document Revision 1.2 ...

Page 48

USB Audio Software Design Guide 5.1.1 System Feature Configuration Define INPUT DFU DFU_CUSTOM_FLASH_DEVICE Define to enable use of custom flash de- MIDI CODEC_SLAVE NUM_USB_CHAN_IN NUM_USB_CHAN_OUT MAX_FREQ I2S_CHANS_DAC I2S_CHANS_ADC SPDIF SPDIF_RX ADAT_RX MIXER Description Define for enabling audio input, in de- ...

Page 49

... Description Vendor ID Product ID (Audio Class 2) Product ID (Audio Class 1) Device release number in BCD form String identifying vendor String identifying serial number 49/57 Default 0x8100 0 0x100 0x8080 0x0600 0x080 Default (0x20B1) N/A N/A N/A XMOS “0000” Document Revision 1.2 ...

Page 50

USB Audio Software Design Guide 5.2.1 Codec Configuration Functions void CodecInit ( chanend ?c_codec ) This function is called when the audio thread starts after the device boots up and should initialize the CODEC. Parameters c_codec – An optional chanend ...

Page 51

USB Audio Software Design Guide 5.2.3 Audio Streaming Functions void AudioStreamStart ( void ) This function is called when the audio stream from device to host starts. void AudioStreamStop ( void ) This function is called when the audio stream ...

Page 52

USB Audio Software Design Guide tokens are not read, the USB layer will block up SOF tokens are required null should be used as this channel. ep_type_table_out – See ep_type_table_in ep_type_table_in – This and ep_type_table_out are two arrays ...

Page 53

USB Audio Software Design Guide void Endpoint0 ( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCtrl, chanend ?c_mix_ctl, chanend ?c_clk_ctl Function implementing Endpoint 0 for enumeration, control and configuration of USB audio devices. It uses the descriptors defined in Parameters c_ep0_out – ...

Page 54

USB Audio Software Design Guide c_aud_ctl – Audio control channel connected to p_off_mclk – A port that is clocked of the MCLK input (not the MCLK input itself) void decouple ( chanend c_audio_out, chanend ?c_led, chanend ?c_midi, chanend ?c_clk_int Manage ...

Page 55

USB Audio Software Design Guide c_dig – channel connected to the mitting samples c_config – An optional channel that will be passed on to the CODEC configuration functions. void clockGen ( streaming chanend c_spdif_rx, chanend c_adat_rx, out port p, chanend ...

Page 56

USB Audio Software Design Guide b – clock block set to 100MHz void adatReceiver48000 ADAT Receive Thread (48kHz sample rate). Parameters p – ADAT port - should be 1-bit and clocked at 100MHz oChan – channel on which decoded samples ...

Page 57

... XMOS Limited is the owner or licensee of this design, code, or Information (collectively, the “Information”) and is providing it to you “AS IS” with no warranty of any kind, express or implied and shall have no liability in relation to its use. XMOS Limited makes no representation that the Information, or any particular implementation thereof will be free from any claims of infringement and again, shall have no liability in relation to any such claims ...

Related keywords