usb-audio

6

Click here to load reader

Upload: alex-negulescu

Post on 21-Apr-2015

119 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: USB-audio

AUDIO&VIDEO

14 Elektor Electronics 12/2002

The circuit described in this articleis built around a ‘stereo audio codec’IC type PCM2902 from Texas Instru-ments/Burr-Brown. Clearly, this chipis from the same family as thePCM2702 we used in the USB Audio-DAC. However, it is also an upgradebecause besides the features of the2702 (analogue stereo output, USBinterface) it also sports an analoguestereo output and an S/PDIF inputand output. The latter even allowdigital recordings to be made to andfrom the PC. One proviso should bementioned, however. The PCM2902processes digital audio signalsaccording to the Serial Copy Man-agement System (SCMS) and willswitch to the analogue input if it dis-covers a copied signal. If signals aresimultaneously applied to the S/PDIFand analogue inputs, the digitalinput is automatically selected (iforiginal data is being applied).

If you want to know all the insand outs of this interesting IC, getthe datasheet from www.ti.com. Towet your appetite the block diagramof the PCM2902 is given in Figure 1.

Just as with the PCM2702, the2902 guarantees a very decent qual-

USB Audio Codecwith S/PDIFrecord digital audio with your PCDesign by T. Giesberts

The USB Audio-DAC described exactly two years ago receivedunexpected acclaim as a small external sound card. Soon after thepublication we received an number of requests for a similar circuit, butthen capable of recording via the USB port. The codec presented in thisarticle does just that, and more, while not a much more elaborate circuitthan the Audio-DAC.

Page 2: USB-audio

AUDIO&VIDEO

1512/2002 Elektor Electronics

ity of the signal processing, sothere’s no need for audio purist toskip these pages! Those of you whoinsists on performance figures to beconvinced of the need to build a cir-cuit are referred to the inset whichlists some measurement resultsobtained from our prototype.

KISSDespite the fact that we’re dealingwith some pretty complex circuitryhidden away in the PCM2902, thefinal design meets the KISS require-ment (keep it simple stupid). Besidesthe audio codec, IC1, the circuit hasjust a few more active parts — atransistor, a voltage regulator, a dou-ble opamp and an optical input andoutput module. Add a handful ofpassive parts and Bob’s your uncle.

The codec card is bus powered,which means that the entire circuitis supplied from the 5-volt pin of theUSB port. Components L1 and L2 arepurposely located close to the USBconnector to eliminate noise directlyat the source. Hence, these inductorsare SMDs (surface mount devices)and fitted on the pins of K3, at theunderside of the board — moreabout this further on. Incidentally,the PCM2902 has an on-chip voltageregulator.

Input circuitThe analogue input has a fixed sen-sitivity, so you will not see the usualslider pot in the window containingthe recorder properties. Because ofthis, each analogue input channelhas a jumper for HI/LO (high/low)input level selection. The HI level isset to about 2 V by means of twopotential dividers, R1/R2 and R3/R4.The input range of the ADC insidethe PCM2902 is determined by thelevel of VCCCI (0.6 times VCCCI).Every user is, of course, free toreplace the fixed potential dividerswith a stereo potentiometer. Capaci-tors C2 and C3 decouple the directvoltage at the IC inputs. The voltageamounts to (approximately) VCCCI/2(= VCOM) so will be around 1.65 V.

In order to increase the quality ofthe A-to-D conversion, the manufac-turer recommends powering VCCCIby a separate voltage regulator.Hence the addition of IC5 to the cir-cuit. Here, a low-drop 3.3-volt regu-

PCM2902 FUNCTIONAL BLOCK DIAGRAM

SSPND

S/PDIF DecoderDIN

Lock

ADC

VINL

VINR

VCOM

FIFO

Selector

AnalogPLL

AnalogPLL

FIFODAC

VOUTL

VOUTR

S/PDIF EncoderDOUT

XTI XTO12 MHz

PLL (x8)96 MHz Tracker

(SpAct)

USBProtocol

Controller

PowerManager

ISO-InEndpoint

ControlEndpoint

ISO-OutEndpoint

HIDEndpoint

US

B S

IE D+

D–XC

VR

SEL0SEL1

HID0HID1HID2

020178 - 12

VBUS

5-V to 3.3-V V oltage Regulator

VCCCI VCCP1I VCCP2I VCCXI VDDI DGNDUDGNDAGNDXAGNDPAGNDC

Figure 1. Internal architecture of the PCM2902 Stereo Audio Codec.

Measurement results(VBUS= 4.84 V, VCCCI = 3.5 V)

Current consumption approx. 90 mA

DACNominal output voltage (0 dB) 1.1 VrmsFrequency range (–3 dB) 22.7 kHz (fs = 48 kHz)Relative amplitude at 20 kHz –0.8 dB (fs = 48 kHz)Analogue filter bandwidth 28 kHzOutput impedance 100 ΩSignal/noise ratio > 95 dBATHD+N (1 kHz) 0.005% (B = 22 kHz)

0.046% (B = 80 kHz)Channel separation > 99 dB (1 kHz)

> 76 dB (20 kHz)ADCInput voltage range 0.75 Vrms (LO)

2.1 Vrms (HI)Input impedance 7.7 kΩ (LO)

10 kΩ (HI)THD+N (1 kHz, –0.5 dBFS) 0.01% (B = 22 kHz)Channel separation > 73 dB (1 kHz)

> 47 dB (20 kHz)

Page 3: USB-audio

lator type LE33CZ is used. The IC is suppliedby ST and comes in a TO92 case. Its presencereduces harmonic levels by more than 10 dBas compared with the internal voltage regu-lator. If you want to squeeze the ADC for low-est distortion, you may insert a BAT85 diodein the ground line (centre pin) of the LE33CZ.This optional addition is shown in dashedoutline in the circuit diagram. The anode ofthe BAT85 diode goes to the regulator groundpin. The diode raises the reference voltagefrom 3.3 to about 3.5 V. Although a dedi-cated 3.5-V regulator does exist under thedesignation LE35CZ, this component is noteasily available.

Because the ADC has an on-chip anti-aliasing filter, the input circuit is marked bydelightful simplicity. However, to ensure goodsonic quality, MKT (Siemens) or equivalentcapacitors are specified for positions C1 andC2. Do not be tempted to use electrolyticshere.

Output circuitAs regards structure and specifications, theDAC closely resembles the ‘old’ PCM2702.Internally there’s a low-pass filter with a roll-

off at 250 kHz. As with all delta-sigma DACs, the noise level risesconsiderably beyond 20 kHz or sodue to noise shaping. To eliminatethe various distortion products, athird-order Butterworth low-pass fil-ter with fc = 28 kHz is applied.Because the amplifier for this filter issupplied from the VBUS 5-volt line,the signal at the DAC output may beamplified a little (1.5 times). Thisensures a maximum output level ofmore than 1 Vrms. The amplifier isrealised by an opamp typeOPA2553UA which comes in an SMDSO-8 case. The same chip wasapplied in the USB Audio-DAC withexcellent results. It is marked byhigh speed, low noise, low distortionand (very important) rail-to-rail volt-age swing at the input and output.

The filter outputs are equippedwith the standard decoupling capac-itors (again MKT types) and smallseries resistors to cancel the effect ofcapacitive loads. R15 and R22 ensurethat these output capacitors remain

charged (the input p.d.’s at the ADChave the same function). C15 andC22 suppress any RF noise (remem-ber, the complete circuit s electricallyconnected to the PC…). In additionto these measures, the opamp is pro-vided with its own supply decou-pling network consisting of L4, C27and C28.

Other detailsWe can be brief about the S/PDIFinput and output. As illustrated bythe circuit diagram, these consistessentially of the well-known Toslinkmodules — a TORX173 for the inputand a TOTX173 for the output. TheToslink modules (IC3 and IC4) aredirectly connected to the relevantpins of IC1 and they are poweredfrom the +5-volt rail using traditionaldecoupling components.

The PCM2902 has a HID volumecontrol feature and a mute function.Jumpers JP3, JP4 and JP5 allowmute, volume-up and volume-downto be adjusted respectively. You

AUDIO&VIDEO

16 Elektor Electronics 12/2002

R8

1M

X1

12MHz

C8

33p

C7

33p

C13

10µ63V

C19

1µR5 4x 1k5 1

2345

JP4 JP5JP3

R6

22Ω

R7

22Ω

C4

22p

C3

22p

C25

C26

C20

L2

L1

K1 K2

R3

6k49

R1

6k49

R2

3k

92

R4

3k

92

JP1

JP2

C23µ3

C13µ3

TORX173IC3

1

2 4

3

5 6

TOTX173IC4

1

2

3

4

C24

100n

C23

100n

R24

8k2

R23

4Ω7L3

47µH

VBUS

VBUS

VBUS

VCCC

R25

10

0k

R26

33

k

R27

1k

5

D1

VBUS

R16

5k76

R17

6k81

R18

6k65

C16

1n5

C18

470p

C17

1n

R20

10k0

R21

100Ω

R19

20

k0

R22

10

0kC22

47p

C21

3µ36

5

7IC2.B

R9

5k76

R10

6k81

R11

6k65

C9

1n5

C11

470p

C10

1n

R13

10k0

R14

100Ω

R12

20

k0

R15

10

0kC15

47p

C14

3µ3

2

3

1IC2.A

VOLUME:

JP3: MUTEJP4: UPJP5: DOWN

L1, L2 = BLM31AJ601SN1L

020178 - 11

LE33CZIC5

C6

100n

C28

100n

C27

100µ10V

C12

10µ63V

C5

10µ63V

VBUS VCCC

BAT85

L4

47µH

IC2

8

4

VBUS

LINELINE

IC2 = OPA2353UA

LO HI

LO HI

USB

T1

BC557B

PCM2902

VC

CP

1I

VC

CP

2I

VOUTL

VC

CC

I

AG

ND

C

DG

ND

U

AG

ND

X

AG

ND

P

VC

CX

I

VOUTR

SSPND

VINR

IC1

VCOM DG

ND

VD

DI

VINLS

EL

0

SE

L1

HID0

HID1

HID2 VBUS

DOUT

XTI XTO

DIN

20

16

13

21

10

14 11 262218

17 19 2327

15

12

D–

D+

28

2524

4

8 9

5

6

7

2

1

3

K3 3

2

4

1

Figure 2. The circuit diagram excels in simplicity because all the complex stuff is inside IC1.

Page 4: USB-audio

reported on pin 28 and an LED is used toindicate that the IC is ‘temporarily out oforder’. LED is purposely connected throughto ground to prevent damage to the IC whena short-circuit occurs. A small converter builtaround T1 converts the 0 V/3.3 V suppliedby the SSPND output into a 2-mA currentrequired for the high-efficiency LED. In thisway, the LED connection may be employed tosignal to other digital equipment that the sig-nal is temporarily not available.

Printed circuit boardThe design of the printed circuit board devel-oped for the USB audio codec is shown in Fig-ure 3. The board is available ready-madethrough the Publisher’s Readers Services. Allconnections on the board have been kept asshort as possible to keep the unit as compactas possible. As you have come to expect froma high-quality Elektor board, all connectorsare fitted at the edge(s).

The vast majority of components thatmake up the circuit are off the shelf types andtheir mounting is unlikely to present prob-lems. However, working with SMDs requiressome getting used to, and that is why we rec-ommend starting with these parts. With IC2,the pin leading is such that soldering is nottoo difficult. IC1, however, requires a steadyhand and a solder iron with a fine tip. Care-fully position the IC on the board and first sol-der diagonally opposed pins. Then check ifthe IC body needs re-positioning. If not, sol-der the other pins quickly and not using toomuch solder. Use fresh desoldering braid toremove excess solder and do not forget to letthe IC cool down in between solder actions.

Besides integrated circuits the PCB alsocontains a couple of SMDs — supply filteringchokes L1 and L2, and four decoupling capac-itors for a number of supply internal to thePCM2902. Of these four miniature 1-?F capac-itors, C20, C25 and C26 are mounted at thetop side of the PCB, in the space between IC1and quartz crystal X1 (see the close-up pho-tograph in Figure 4). Capacitor C19 ismounted at the solder side of the board,between two through-plating spots. ChokesL1 and L2 also end up at the underside of theboard (see Figure 5). The board allows SMDswith 06003 cases as well as the larger 0805cases to be fitted. The latter are preferredbecause they are larger and therefore easierto handle.

Software installationThe installation of the board under Windows98SE is unlikely to cause problems. First youwill be notified that a ‘USB Audio Codec’ has

could, for example, connect threepushbuttons to these jumper pinsand so enable basic volume controlwithout access to the PC. When con-necting such pushbuttons, be care-ful to avoid short-circuits to ground.

Installation of this USB compo-

nent under Windows 98 or higherresults in two items being added tothe Human Interfaces. Consequentlya report is filed back to the operatingsystem specifying the current vol-ume, mute state, etc.

The state of the Suspend flag is

AUDIO&VIDEO

1712/2002 Elektor Electronics

C1

C2

C3

C4

C5 C6

C7

C8

C9

C10

C11

C12

C13

C14 C15

C16

C17C18

C20

C21 C22

C23

C24

C25

C26

C27

C28

D1

H1

H2 H3

H4

IC1

IC2

IC3

IC4

IC5

JP1

JP2

K1

K2

K3

L3

L4

OU

T1

OU

T2

R1R2

R3R4

R5

R6R7

R8

R9R10R11

R12 R13

R14

R15

R16R17R18

R19 R20

R21

R22

R23

R24

R25

R26

R27T1

X1

DOWNVOLUME

LOLO

HI

HI

020178-1

MUTE UP

C19

L1

L2

(C) ELEKTOR020178-1

Figure 3. Copper track layout and component mounting plan of the PCB designedfor the USB Audio Codec (board available ready-made).

Page 5: USB-audio

been found, which requires driversto be installed. Next, three devicesare found (keep the Windows CD-ROM handy): a ‘USB CompositeDevice’, a ‘USB Human InterfaceDevice’ and finally a ‘USB AudioDevice’.

These three items may be foundback under the System Proper-ties/Device Manager tab, see thescreendump in Figure 6. Next, withPlayback properties you should seethree slide controls: Desktop, Waveand SW Synth. A fourth slider called‘CD Player (for Window’s own sim-ple software player for audio CDs),

will be missing and is not foundback until the PC is restarted.

In Control Panel, under the Multi-media/CD Music tab, do not forget tocheck the ‘Enable digital CD audiofor this CD-ROM device’. When theUSB link is briefly interrupted, thecontrol will probably disappear. Thisis normal (at least, for Windows) andcaused by a bug in the operatingsystem. The problem has not beensolved under Windows ME or XP,which use different names for someof the windows and controls.

For a quick test of the HID inter-face, open the volume control win-

AUDIO&VIDEO

18 Elektor Electronics 12/2002

COMPONENTS LIST

Resistors:R1,R3 = 6kΩ49R2,R4 = 3kΩ92R5 = 4-way 1kΩ5 SIL arrayR6,R7 = 22ΩR8 = 1MΩR9,R16 = 5kΩ76R10,R17 = 6kΩ81R11,R18 = 6kΩ65R12,R19 = 20kΩ0R13,R20 = 10kΩ0R14,R21 = 100ΩR15,R22,R25 = 100kΩR23 = 4Ω7R24 = 8kΩ2R26 = 33kΩR27 = 1kΩ5

Capacitors:C1,C2,C14,C21 = 3µF3 50V, MKT

(Siemens), lead pitch 5 or 7.5mmC3,C4 = 22pFC5,C12,C13 = 10µF 63V radialC6,C23,C24,C28 = 100nF ceramic, lead

pitch 5mmC7,C8 = 33pFC9,C16 = 1nF5 1% *C10,C17 = 1nF 1% *C11,C18 = 470pF 1% *C15,C22 = 47pFC19,C20,C25,C26 = 1µF 25V, SMD case

0805 (e.g., Farnell # 317-640)C27 = 100µF 10V radial

*) polypropylene or polystyrene (EMZ)

Inductors:L1,L2 = BLM31A601S, SMD case 1206

(e.g., Farnell #. 581-094)L3,L4 = 47µH

Semiconductors:D1 = LED, red, high efficiencyT1 = BC557BIC1 = PCM2902 (Texas Instruments/Burr-

Brown)IC2 = OPA2353UA (Texas

Instruments/Burr-Brown)IC3 = TORX173 (Toshiba)IC4 = TOTX173 (Toshiba)IC5 = LE33CZ (ST) (e.g., Farnell # 302-

4568)

Miscellaneous:JP1,JP2 = 3-way SIL pinheader with jumperJP3,JP4,JP5 = 2-way SIL pinheaderK1,K2 = 3.5mm stereo jack socket, PCB

mount (Conrad Electronics # 73 28 93-88)K3 = USB connector, PCB mount, type BX1 = 12 MHz quartz crystal, parallel

resonance, (Cload = 30pF)PCB, order code 020178-1 (see Readers

Service page)

Figure 4. Mounting IC1, C20, C25 and 26 requires precision in soldering.

Figure 5. Just like C19, SMD chokes L1 and L2 are fitted at the solder side of theboard.

Page 6: USB-audio

dow. If you establish a contact between thepins of jumpers JP3, JP4 and JP5, you will see‘Mute’ going on and off with the loudspeakerslider, while the slider itself moves up ordown.

TipThose of you who want to test this littlesound card may find freeware and sharewareon the Internet. During our ‘quest’ we cameacross ‘audioTester at this website:

www.sumuller.de/audiotester

This software turns your codec into an audiotest system comprising a spectrum analyser,an oscilloscope and a signal generator. Wetested version 1.4h which comes highly rec-ommended.

(020178-1)

AUDIO&VIDEO

1912/2002 Elektor Electronics

Figure 6. The software installation is quite straightforward (Windows 98SE).

If a picture…A number of test graphs were plotted that show the equivalent of two pagesof text or more.

The first graph (A) is practically oriented showing the audio level response ofthe ADC and the DAC connected in series. To make this measurement weemployed the ASIO Multimedia Driver from Cubase VST/32. The standardUSB audio drivers in Windows do not allow full-duplex operation, hence pre-vent you from listing in on the recording! Oddly they do allow an audio CDor a wave file to be played at that time! At 20 kHz, the audio level hasdropped by just 0.8 dB. Because the graph scale has been enlarged, the rip-ple caused by the digital filter of the DC is clearly visible — it is not caused bythe analogue filter!

Graph B shows distortion and noise as a function of frequency. Here, too, theADC and DAC are measured in series. The distortion is mainly caused by theADC, and closer scrutiny using FFT analysis indicates the presence of othermixing products besides the expected harmonic distortion. These productsare probably generated by the internal PLL and the digital filters. From 5 kHzonwards, the aliasing products contribute most to the overall distortion. How-ever, they do not have alarming levels given the simplicity of the circuit.

Curve C, finally, shows the frequency spectrum of 997 Hz with full drive ofthe DAC (using a test CD). All harmonics are below –90 dB and account fornearly all of the 0.005% distortion measured. All noise above 20 kHz is typ-ical for delta-sigma converters using noise sampling, and is not worrying if ameasurement bandwidth of 22 kHz is used. The analogue output filter limitsthe larger part of the noise and aliasing products above 35 kHz to accept-able levels. If the bandwidth of the THD+N measurement is extended to 80kHz, these products will of course cause the overall distortion to increase(to 0.046%).

-4

+2

-3.6

-3.2

-2.8

-2.4

-2

-1.6

-1.2

-0.8

-0.4

+0

+0.4

+0.8

+1.2

+1.6

dBr

10 20k020178- 14

20 50 100 200 500 1k 2k 5k 10kHz

0.001

10

0.002

0.005

0.01

0.02

0.05

0.1

0.2

0.5

1

2

5

%

20 20k50 100 200 500 1k 2k 5k 10kHz 020178- 15

-150

+0

-140

-130

-120

-110

-100

-90

-80

-70

-60

-50

-40

-30

-20

-10

dBr

20 90k50 100 200 500 1k 2k 5k 10k 20k 50kHz 020178- 16

A

B

C