Académique Documents
Professionnel Documents
Culture Documents
By
Spring 2009
tf
r a
D
Audio Processing on the Xilinx ML403 Virtex-4 Evaluation Board
The ML403 board contains the LM4550 (National Semiconductor), which is an AC ‘97 Audio
Codec. The LM4550 is circled in yellow as shown below. The microphone and line-in inputs
are shown as well as the line-out and headphone outputs.
tf
a
The physical connections to the LM4550 can be seen in the Audio Codec page of the ML403
r
Schematics and can be seen in the following figure. The microphone and line-in inputs are
shown in the schematics as well as the line-out and headphone outputs. The LM4550 is capable
of additional audio I/O, but these are not connected in the ML403.
D
Table of Contents goes here.....
tf
r a
D
4 3 2 1
2
1M 1 C22 FB7 1 C21
0805 0805
24.576MHZ
R120
3.3K
FB0805
2 2
R119
3.3K
1UF 1UF
1
1 2
FB8
GND_AUDIO
VCC3V3
X4
XTAL_SMD
AUDIO_SDATA_IN
C12
1UF
6.81K 0805 1 C113 1 C23
LINE_INPUT_JACK 1 C115
2 1 1 C117 1 C13 0.1UF
1
2
1 R111 2 2
2
0.1UF 1UF
0.1UF 2
0805
5 2 2 1UF
R112
0805
12
11
10
9
8
7
6
5
4
3
2
1
C18
220UF
D
4
1
6.81K
C C
3
1
2 2
2
J14
SYNC_10
DVDD2_9
DVSS2_7
DVSS1_4
DVDD1_1
1 C122
XTL_IN_2
BIT_CLK_6
XTL_OUT_3
C14
PC_BEEP_12
RESET_N_11
SDATA_IN_8
1UF
J12 6.81K 0805 10K
SDATA_OUT_5
R118
220PF 2
2
1
2 1 3
1
2
R114
2
C17
220UF
D
4
0805
R113
13 48 NC 1UF 2 5
13_PHONE_IN CIN_JS1_48
14 47 NC
1
2
14_AUX_L EAPD_JS0_47
1
6.81K
2
MICROPHONE_JACK 18 43 NC 220PF
18_CD_L NC_AVDD3_43 2
C9
19 42 NC
1UF
19_CD_GND_REF NC_42
1
1 1K 0805 20 41
20_CD_R HP_OUT_R_41
21 21_MIC1 HP_OUT_C_AVSS2_40 40
5 2 1 22 39
1
2
R107 22_MIC2 HP_OUT_L_39
23 23_LINE_IN_L NC_AVDD2_38 38 NC
4 24 37 NC
24_LINE_IN_R MONO_OUT_37
C16
2
1UF
3
0805
R108
49.9K
1
2
B B
2
J13
1
1 C114 1 C120
J11
10K
R116
0.1UF 220PF 2
2 2
1
DEVICE=LM4550VH 3
PKG_TYPE=LQFP48
C15
PARTS=1 4
1UF
25_AVDD1
26_AVSS1
27_VREF
28_VREFOUT
29_NC_AFILT1
30_NC_AFLIT2
31_NC_FILT_R
32_NC_FILT_L
33_3DN_RX3D
34_3DP_CX3D
35_LINE_OUT_L
36_LINE_OUT_R
47R 2.2K LEVEL=STD
D
0805
25
26
27
28
29
30
31
32
33
34
35
36
2 1 2 1
1
2
R110 R109
2
1 C10 1
1 C119
220PF U14 LINE_OUTPUT_JACK
r
2 10K
NC
NC
NC
NC
R115
220PF
2
1
1 C403
a
0.1UF
2 2 1UF
0.022UF
C118
0603
tf
VCC5_AUDIO
10K
1
2
Title:
A 2 1
R240 Audio Codec
1 C11 1 C116
A
2.2UF 0.1UF Date: Ver:
2 2
Sheet Size: B Rev: B
Sheet of Drawn By
17 24 BF
4 3 2 1
The user guide description of the audio codec (p. 24) is shown below:
Detailed Description
R
tf
communicate serial data with another device. The serial port is wired as a host (DCE)
device. Therefore, a null modem cable is normally required to connect the board to the
serial port on a PC. The serial port is designed to operate up to 115200 Bd. An interface chip
a
is used to shift the voltage level between FPGA and RS-232 signals.
r
Note: The FPGA is only connected to the TX and RX data pins on the serial port. Therefore, other
RS-232 signals, including hardware flow control signals, are not used. Flow control should be
disabled when communicating with a PC.
D
A secondary serial interface is available by using header J27 to support debug of the USB
controller chip. Header J27 brings out RS-232 voltage level signals for ground, TX data, and
RX data.
www.national.com
1 2 3
4 5
2
8
11 7 6
9
D
r
10
a
tf
10097201
Signal Path Control Settings
The following register descriptions refer to the signal path block diagram below
and on page xxxx where the control setting numbers refer to the boxed num-
bers on the signal path.
L M4 5 5 0
www.national.com
1 2 3
4 5
8
2
11 7 6
9
10
The microphone #1 or #2 can be selected by setting the general purpose register 20h.
tf
D15 POP 0 Go through 3D block
1 Bypass 3D block
D13 3D 0 3D sound off
a
1 3D sound on
r
D9 MIX 0 Mono output = Mix (not connected)
1 Mono output = Mic (not connected)
D
D8 MS 0 Mic select = MIC1
1 Mic select = MIC2
D7 LPBK 0 No ADC/DAC Loopback
1 Enable ADC/DAC Loopback
Default: 0000h (MIC1 input)
L M4 5 5 0
www.national.com
B lo c k D ia gr a m Signal Path for ML403_LM4550 and Control Register Settings
1 2 3
4 5
8
2
11 7 6
9
10
The microphone input can have a 20dB volume boost by setting bit D6 in the microphone vol-
ume register 0Eh.
tf
0 0_0000 +12 dB gain
0 0_1000 0 dB gain
0 1_1111 34.5 dB attenuation
a
1 x_xxxx mute
r
Default: 8008h (mute, 0 dB gain)
Note 1: Bit D6 controls the 20dB boost on the input that gets routed to the input
D
selection mux. The other bits (mute and gain/attenuation) control input into mixer 1.
Note 2: The mute only works for signal input into mixer 1 (it doesn’t mute the mic
input going to the input selection mux)
Note 3: The bits in D4:D0 control the gain from +12 dB to -34.5 dB in steps of -1.5
dB into mixer 1.
L M4 5 5 0
www.national.com
B lo c k D ia gr a m Signal Path for ML403_LM4550 and Control Register Settings
1 2 3
4 5
8
2
11 7 6
9
10
10097201
The input selection multiplexer controls which input is selected and is controlled via register 1Ah.
tf
3 - 011b Aux input 3 - 011b AUX input
4 - 100b Line-in 4 - 100b Line-in
5 - 101b Stereo Mix 5 - 101b Stereo Mix
a
6 - 110b Mono Mix 6 - 110b Mono Mix
r
7 - 111b Phone input 7 - 111b Phone input
Default: 0000h (Mic input on both left and right channels)
D
Note 1: The CD, Video, Aux, Phone inputs are not connected.
Note 2: The left and right channels can be independently selected.
L M4 5 5 0
www.national.com
B lo c k D ia gr a m Signal Path for ML403_LM4550 and Control Register Settings
1 2 3
4 5
8
2
11 7 6
9
10
10097201
The selected input can have up to a 22.5dB gain boost by setting the record gain register 1Ch.
tf
1 xxxx mute (-86 dB)
Default: 8000h (mute, 0 dB gain)
Note 1: Bit D15 when set will mute the input.
a
Note 2: The bits in Gx4:Gx0 control the gain from 0 dB to +22.5 dB in steps
r
of +1.5 dB.
D
L M4 5 5 0
www.national.com
B lo c k D ia gr a m Signal Path for ML403_LM4550 and Control Register Settings
1 2 3
4 5
8
2
11 7 6
9
10
10097201
The input can be sampled from 4 KHz to 48 KHz by setting both the ADC sample rate control register
32h and the extended audio status/control register 2Ah.
tf
REG Name D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 Default
32h PCM SR15 SR14 SR13 SR12 SR11 SR10 SR9 SR8 SR7 SR6 SR5 SR4 SR3 SR2 SR1 SR0 BB80h
ADC
a
Rate
r
SR15:SR0 Function
0FA0h 4 KHz (minimum rate)
BB80h 48 KHz (maximum rate)
D
Default: BB80h (48 KHz)
Note 1: The sample rate can be programmed, in 1 Hz increments, to be any value from 4 KHz
to 48 KHz. The value required is the hexadecimal value of the desired sample rate, e.g. 8000
Hz would be specifed as 800010 = 1F40h.
tf
r a
D
Control Setting #6 - Output Sample Rate
The output can be sampled from 4 KHz to 48 KHz by setting both the DAC sample rate control
register 2Ch and the extended audio status/control register 2Ah.
SR15:SR0 Function
0FA0h 4 KHz (minimum rate)
BB80h 48 KHz (maximum rate)
Default: BB80h (48 KHz)
Note 1: The sample rate can be programmed, in 1 Hz increments, to be any value from 4 KHz
to 48 KHz. The value required is the hexadecimal value of the desired sample rate, e.g. 8000
Hz would be specifed as 800010 = 1F40h.
The output volume can be controlled by setting the PCM out volume register 18h.
tf
Mute (Bit D15) Gx4:Gx0 Function
(Bits D12:D8 - Left)
a
(Bits D4:D0 - Right)
r
0 0_0000 +12 dB gain
0 0_1000 0 dB gain
D
0 1_1111 34.5 dB attenuation
1 x_xxxx mute (-86 dB)
Default: 8808h (mute, 0 dB gain on both channels)
Note 1: The bits in Gx4:Gx0 control the gain from +12 dB to -34.5 dB in steps of
-1.5 dB.
Control Setting #8 & #9 - Output 3D Sound Path Control
The output can be routed through the National 3D Sound block by setting the general purpose
register 20h.
The line-out volume is set in the master volume control register 02h.
tf
(Bits D4:D0 - Right)
0 0_0000 0 dB attenuation
0 1_1111 46.5 dB attenuation
a
1 x_xxxx mute on both channels (-86 dB)
r
Default: 8000h (mute, 0 dB attenuation on both channels)
Note 1: The bits in Mx4:Mx0 control the gain from 0 dB to -46.5 dB in steps of -1.5 dB.
D
Control Setting #11 - Headphone Volume Control
The Headphone volume is set in the headphone volume control register 04h.
tf
r a
D
Designing the AC97 Digital Controller
tf
r a
D
The Virtex-4 FPGA communicates and controls the LM4550 via five digital I/O lines that can be
seen on the previous page and their description is given below:
tf
FLASH_AUDIO_ AD10 Cold Reset
RESET_N This active low signal causes a hardware reset which returns
the control registers and all internal circuits to their default
a
conditions. RESET# must be used to initialize the LM4550
(resets registers to
r
after Power On when the supplies have stabilized. Cold
default) Reset also clears the codec from both ATE and Vendor test
modes. In addition, while active, it switches the PC_BEEP
D
mono input directly to both channels of the LINE_OUT ste-
reo output.
AC Link Serial Interface Protocol
Note: The LM4550 expects to receive data MSB first, The time slots 5-12 are not used
in a MSB justified format. Set output bits to zero.
Perform the following steps (all bits are zero unless otherwise noted):
1. Set bit 15 (first bit sent in 16-bit TAG slot) of TAG data (slot 0) to ‘1’ to indicate that the frame
has at least one slot of valid data. This is bit 0 counting to 255. AUDIO_SYNC must be held
tf
high (‘1’) for the duration of the 16 clock cyles that comprise the TAG slot.
2. Set bit 12 of TAG data to ‘1’ to indicate that slot 3 has PCM data for the left channel. This is
bit 3 counting to 255.
a
3. Set bit 11 of TAG data to ‘1’ to indicate that slot 4 has PCM data for the right channel. This is
r
bit 4 counting to 255.
4. Insert the Left PCM data into slot 3. The 18-bit two’s complement number is sent MSB first
where bit 17 of the PCM data is sent as the first bit of slot 3 (bit 19). These are bits 56:73 count-
D
ing to 255. The last two bits of slot 3 are set as zero (don’t care since the DACs are 18 bit and
only read the first 18 bits). These are bits 73:75 counting to 255. 10097206
5. Insert the Right PCM data into slot 4. This is done in a similar fashion to the left PCM data.
FIGURE 4. AC Link Output Frame
These are bits 76:93 counting to 255.
Reading Data from the AC97 (Recording a sound)
1. Read bit 15 (first bit of the 16-bit TAG slot) of TAG status data (slot 0). A ‘1’ indicates the
AC Link interface is ready. This is bit 0 counting to 255.
2. Read bit 12 of TAG data. A ‘1’ to indicates that slot 3 has valid PCM data from the left chan-
nel. This is bit 3 counting to 255.
3. Read bit 11 of TAG data. A ‘1’ to indicates that slot 4 has valid PCM data from the right chan-
nel. This is bit 4 counting to 255.
4. Read the Left PCM data from slot 3. The 18-bit two’s complement number is sent MSB first
where the data is located in bits 19:2. These are bits 56:73 counting to 255.
5. Read the Right PCM data from slot 4. The 18-bit two’s complement number is sent MSB first
where the data is located in bits 19:2. These are bits 76:93 counting to 255.
tf
r a
D
Sending Commands to the AC97 (Writing to Registers)
Perform the following steps (all bits are zero unless otherwise noted):
1. Set bit 15 (first bit sent in 16-bit TAG slot) of TAG data (slot 0) to ‘1’ to indicate that the frame
has at least one slot of valid data. This is bit 0 counting to 255. AUDIO_SYNC must be held
high (‘1’) for the duration of the 16 clock cyles that comprise the TAG slot. Note: this is most
likely already being done when sending sound out.
2. Set bit 14 of TAG data to ‘1’ to indicate that slot 1 has the control address (register address).
This is bit 1 counting to 255.
3. Set bit 13 of TAG data to ‘1’ to indicate that slot 2 has the control data (register data). This is
bit 2 counting to 255.
4. Insert the control address into slot 1. First, set bit 19 to ‘0’ to indicate a write. The 7-bit reg-
ister address is then sent out in slot bits 18:12 of slot 1. These are bits 17:23 counting to 255.
The rest of the bits in the slot are set to zero.
5. Insert the register data into slot 2. The 16-bit register data is loaded into bits 19:4 of slot 2.
These are bits 36:51 counting to 255.
tf
13 CRD Control Register Data 1 = Valid Control Data in Slot 2
12 LDD3 Left DAC Data in Slot 3 1 = Valid PCM Data in Slot 3 = Left Channel Audio
a
11 RDD4 Right DAC Data in Slot 4
r
10 NU Not Used
9 LDD6 Left DAC Data in Slot 6
8 LDD7 Left DAC Data in Slot 7
D
7 RDD8 Right DAC Data in Slot 8
6 RDD9 Right DAC Data in Slot 9
5 NU Not Used
4 NU Not Used
3 NU Not Used
2 NU Not Used
1 ID1
0 ID0
The FPGA Pin # is the is the physical pin of the FPGA connected to the LM4550 I/O. An ex-
ample user constraint file (UCF) is given below:
tf
r a
D