Engineer to Engineer Note EE-23
Notes on using Analog Devices’ DSP, audio, & video components from the Computer Products Division
Phone: (800) ANALOG-D or (781) 461-3881, FAX: (781) 461-3010, EMAIL: dsp.support@analog.com
4) The same single-buffer TDM frame interface is used
An AD1847/ADSP-2181 loopback
example using a single index
register for SPORT autobuffering
Last Modified: 05/06/97
This Edition of Analog Devices Engineer’s Note will
provide some insight into interfacing the AD1847
SoundPort Codec to an ADSP-2181 using a single index
register for transmitting and receiving data via SPORT
autobuffering ad1847. The code was tested using an
AD1847 codec on our ADSP-21XX EZ-KIT-LITE
Evaluation Board. The example talkthru program uses the
AD1847’s 1 wire mode for transmitting and receiving of
data in slots 0-5. The supplied listing contains the
following for the 1-wire, talkthru example:
ADSP 2181 initialization
both for initialization and operation.
5) The initialization commands now come from program
memory rather than data memory. In a real-time
application, this saves the bother of initializing a data
memory array.
6) Since only the SPORT0 interrupt can be active during
initialization, the control flag is passed in the AF register
rather than in a variable.
7) Only the SPORT0 RX interrupt is used, never the TX.
In addition, the SPORT0 RX interrupt vector is altered
after initialization for maximum speed & flexibility.
ADSP 1847 Codec initialization
Interrupt service routines
Changes from the MIC2OUT.DSP version:
1) The ADI EZ-KIT-LITE version did not set the digital
mix control (a minor bug)
2) This version still takes two index registers to set up,
but only needs one index register to run. The EZ-KITLITE version requires three index registers for
initialization and two to run.
3) 1 wire mode is used for the SPORT interface. This
prevents simultaneous tx and rx autobuffer requests,
regardless of bus activity.
A single index interface to the AD1847 works because the
autobuffer transfers are always separated by at least one 16
bit time slot (about 4us at 8 kHz). Transmit autobuffers
happen at the beginning of a time slot, Rx autobuffers at
the end. Since the Tx slots come before the Rx slots,
there is never a conflict.
Note that this does not apply if two or more AD1847's are
cascaded. In such a system, hardware should be added to
allow a dummy time slot between the 6 slots used for
each AD1847. This still allows for up to four AD1847's
on one bus.
Source Code Listing for AD1847drv.dsp
.module/RAM/ABS=0 loopback;
.const IDMA= 0x3fe0;
.const BDMA_BIAD= 0x3fe1;
.const BDMA_BEAD= 0x3fe2;
.const BDMA_BDMA_Ctrl= 0x3fe3;
.const BDMA_BWCOUNT= 0x3fe4;
.const PFDATA= 0x3fe5;
.const PFTYPE= 0x3fe6;
.const SPORT1_Autobuf= 0x3fef;
.const SPORT1_RFSDIV= 0x3ff0;
.const SPORT1_SCLKDIV= 0x3ff1;
.const SPORT1_Control_Reg= 0x3ff2;
.const SPORT0_Autobuf= 0x3ff3;
.const SPORT0_RFSDIV= 0x3ff4;
.const SPORT0_SCLKDIV= 0x3ff5;
.const SPORT0_Control_Reg= 0x3ff6;
.const SPORT0_TX_Channels0= 0x3ff7;
.const SPORT0_TX_Channels1= 0x3ff8;
.const SPORT0_RX_Channels0= 0x3ff9;
.const SPORT0_RX_Channels1= 0x3ffa;
.const TSCALE= 0x3ffb;
.const TCOUNT= 0x3ffc;
.const TPERIOD= 0x3ffd;
.const DM_Wait_Reg= 0x3ffe;
.const System_Control_Reg= 0x3fff;
.var/pm/ram init_cmds[14];
.var/dm/ram/circ buf[6];
.var/dm/ram vol[2];
{-----------------------------------------------------------------------------
Note that the order here seems a little funny. The control field is
where
it is due to buffering in Sport0's transmitter. It is actually the
control
field that will be transmitted in the next frame.
---------------------------------------------------------------------------}
#define left_out buf
#define right_out buf+1
#define control buf+2
#define status buf+3
#define left_in buf+4
#define right_in buf+5
EE-23 Page 2
Notes on using Analog Devices’ DSP, audio, & video components from the Computer Products Division
Phone: (800) ANALOG-D or (781) 461-3881, FAX: (781) 461-3010, EMAIL: dsp.support@analog.com
.init init_cmds:
0xc00600, {
Left input control reg
b7-6: 0=left line 1
1=left aux 1
2=left line 2
3=left line 1 post-mixed loopback
b5-4: res
b3-0: left input gain x 1.5 dB
}
0xc10600, {
Right input control reg
b7-6: 0=right line 1
1=right aux 1
2=right line 2
3=right line 1 post-mixed loopback
b5-4: res
b3-0: right input gain x 1.5 dB
}
0xc28800, {
left aux 1 control reg
b7 : 1=left aux 1 mute
b6-5: res
b4-0: gain/atten x 1.5, 08= 0dB, 00= 12dB
}
0xc38800, {
right aux 1 control reg
b7 : 1=right aux 1 mute
b6-5: res
b4-0: gain/atten x 1.5, 08= 0dB, 00= 12dB
}
0xc48800, {
left aux 2 control reg
b7 : 1=left aux 2 mute
b6-5: res
b4-0: gain/atten x 1.5, 08= 0dB, 00= 12dB
}
0xc58800, {
right aux 2 control reg
b7 : 1=right aux 2 mute
b6-5: res
b4-0: gain/atten x 1.5, 08= 0dB, 00= 12dB
}
0xc68000, {
left DAC control reg
b7 : 1=left DAC mute
b6 : res
b5-0: attenuation x 1.5 dB
}
0xc78000, {
right DAC control reg
b7 : 1=right DAC mute
b6 : res
EE-23 Page 3
Notes on using Analog Devices’ DSP, audio, & video components from the Computer Products Division
Phone: (800) ANALOG-D or (781) 461-3881, FAX: (781) 461-3010, EMAIL: dsp.support@analog.com