Sign in

username:

password:



Not a member?

Search adsp



Search tips

Subscribe to adsp



adsp by Keywords

AD1819 | AD7332 | ADSP-2106 | ADSP-21060 | ADSP-21065L | ADSP-2116 | ADSP-21160M | ADSP-2181 | ADSP-218x | ADSP-219 | ADSP-2199 | ADSP219 | BF531 | BF532 | BF533 | BF535 | Blackfin | FFT | JTAG | LDF | SDRAM | SHARC | SPORT | UART | VDSP++ | VisualDSP

Discussion Groups

Discussion Groups | Analog Devices DSPs | talkthrough initilization

Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).

  

Post a new Thread

talkthrough initilization - Rýfat Yazgan - Sep 28 12:53:00 2003



Hello
I'm Rýfat Yazgan from Turkey. I ve a final project on adsp2189m
evaluation board.I want to work on talkthrough example. But, I could not succeed
to define the microphone and speakers. The kit does not take my voice as an
input and does not give it back to me from the speakers.I want to ask you what
changes I ve to do on software, hardware and codec to run the program correctly
with microphone.

I ve a normal computer microphone and speakers(they have own amplifiers)If you
know the answer please help me

By..

/****************************************************************************\

* TITLE: Talk Through.

* PURPOSE: Show circular buffers compined with Data memory overlay to produce

* huge buffer sizes on the 2189M ez-kit.

*

* This program samples input from the AD73322 codec, stores it in a circular

* buffer, and then sends the data back to the codec for output.

* There is 1 circular buffer of size 16 words to initialize the codec.

* There is a second circular buffer of 70,000 16 bit words. Normally, on the

* 218x family, a buffer is limited to 8K (8196). There are 5 buffers each

* of 14,000 words, spread over the 5 Data Memory overlays.

* A PageTable is set up and the index register of the input and output are

* modified 1 time for every 5 pages. Effectively, this stores 1 word on page

* 0, the next word on page 4, the next on page 5, and so on without incrementing

* the index pointer. When a word is stored on page 7 and the page table wraps

* back to page 0, the InPut buffer index is incremented by 1.

*

* A variable Delay is declared. This can be set by the VisualDSP Host program

* to produce a delayed output.

* A variable Mono is declared. This is used if the user has a Mono (non-stero)

* microphone. When set, it copies the right channel into the left channel.

*

\****************************************************************************/

#include "constant.h";
.GLOBAL CodecStop; /* CODEC stop: irq and auto-buffering */

.GLOBAL CodecInit; /* CODEC initialization */

.GLOBAL SPORT0_TX_INT; /* CODEC initialization commands */

.GLOBAL SPORT0_RX_INT;
.section/data seg_input;

.VAR/CIRC rx_buf[14000]; /* circular
input sample buffer */
.section/data seg_init;

.VAR InitCommands[16] = b#1000100100001111, /* CRB1 */ b#1000000100001111, /* CRB0 */

/*
|--- -- | |-- | | | | +---Sample rate 00=DMCLK/2048, 01=DMCLK/1024, 10=DMCLK/512, 11=DMCLK/256 | | +-----Serial Clock Divider 00=SCLK/8, 01=SCLK/4, 10=SCLK/2, 11=SCLK | +-------Master Clock divider 000=MCLK, 001=MCLK/2, 010=MCLK/3, 011=MCLK/4,
101=MCLK/5 +----------Control Echo Cancel */

b#1000101001111001, /* CRC1 */ b#1000001001111001, /* CRC0 */

/*
|||||||| |||||||+---Power-Up device 0=powerdown, 1=powerup ||||||+----Analog gain tap power (0=powerdown 1=powerup) |||||+-----Input amplifier power (0=powerdonw 1=powerup) ||||+------ADC power (0=powerdown, 1=powerup) |||+-------DAC power (0=powerdown, 1=powerup) ||+--------REF power (0=powerdown, 1=powerup) |+---------REFOUT use (0=disapbe refout, 1=enable refout) +----------1=Enable 5V 0=Disable 5V */ b#1000101100000101, /* CRD1 */ b#1000001100000101, /* CRD0 */

/*
|---|--- | || | | || +----Input gain select 111 +38db | |+-------Reset ADC Modulator (0=off 1=reset enabled) | +--------Output gain select 000 +6db +-----------Output mute (0=mute off, 1=mute enabled) */

b#1000110000000000, /* CRE1 */ b#1000010000000000, /* CRE0 */

/*
|||----- ||| | ||| +----DAC Advteance Settings 0-4 ||+---------IBYP Inrpolator bypass (0=disabled 1=enabled) |+----------Digitaly gain tap enable 0=disabled, 1=enabled +-----------RESERVED (0) */

b#1000110100100000, /* CRF1 */ b#1000010100100000, /* CRF0 */

/*
|||||||||||----- ||| | ||| +-----Analog Gain Tap Coefficient 0-4 ||+----------Single-ended 0=disabled, 1=enabled |+-----------Input Invert (0=disabled, 1=enabled) +------------Analog loopback 1=enable, 0=disable */ b#1000111111111111, /* CRG1 */ b#1000011111111111, /* CRG0 */

/*
--------- +-----Digital Gain Tap 0-7 */ b#1000111011111111, /* CRH1 */ b#1000011011111111, /* CRH1 */

/*
--------- +-----Digital Gain Tap 8-15 */

b#1000100000010001, /* CRA1 */ b#1000000000010001; /* CRA0 */

/*
|---|||| | ||||+-----Data/Program operating mode (0=program, 1=data) | |||+------Mixed Mode (0=off, 1=on) | ||+-------Digital loopback 1=enable, 0=disable | |+--------SPORT loopback mode 0=off, 1=on | +---------Device count +------------Software Reset (0=off, 1=initiate) */ .section/data seg_page;

.VAR PageTable[5] = 0,4,5,6,7;
.section/data seg_data;

.VAR TX_InitEnable = 0;

.VAR Delay = 0;

.section/pm seg_rth;
       
JUMP start; NOP; NOP;
NOP; /* Reset - Interupt vector table
*/

RTI; NOP; NOP; NOP;
/* IRQ2 - No interrupts used
*/

RTI; NOP; NOP; NOP;
/* IRQ1L - Subject to change
*/

RTI; NOP; NOP; NOP;
/* IRQL0

*/

SPORT0_TX_INT: JUMP SPORT0_tx_int_handler; NOP; NOP; NOP; /* SPORT0_TX

*/

SPORT0_RX_INT: JUMP SPORT0_rx_int_handler; NOP; NOP; NOP; /* SPORT0_RX

*/

RTI; NOP; NOP; NOP;
/* IRQE

*/

RTI; NOP; NOP; NOP;
/* BDMA

*/

RTI; NOP; NOP; NOP;
/* SPORT1 TX

*/

RTI; NOP; NOP; NOP;
/* SPORT1 RX

*/

NOP; NOP; NOP; NOP;
/* TIMER - First timer
interrupt must not be a RTI */

RTI; NOP; NOP; NOP;
/* POWERDOWN

*/
/* Below is the test program for the CODEC */

.section/pm seg_code;

start:

imask = 0x0001; I1 = PageTable; /*
Set I1 to the begining of the page table */

M1 = 1;
/* Set M1 to 1 */

L1 = 5;
/* L1 = LENGTH(PageTable); */
I6 = rx_buf; /*
Set I6 to the begining of the input buffer */

M5 = 1;
/* Set M5 to 1 */

L6 = 14000; /*
L6 = LENGTH(InPut);*/
CNTR = L1; /* Set
the counter to 5 pages in the page table */

DO zeroall UNTIL CE; /* Loop through all the
pages */

AR = DM(I1, M1); /* Get the first page
from the page table */

DMOVLAY_AR1: NOP; /* DMOVLAY = AR */ /* set the
page register to the table entry */

CNTR = L6; /* R =
LENGTH(InPut); */ /* set the length of the buffer */

do zero until CE; /* Loop through
the entire page and zero */

zero: DM(I6,M5) = 0; /* Set each memory location to
zero */

zeroall: nop; /* End loop
*/
call CodecStop; /*
Stop the codec */

call CodecInit; /* Initialize
the codec */
IMASK = 0x0001; /* Disable
interrupts except the timer */

I1 = PageTable;

M1 = 1;

L1 = 5;
/* L1 = LENGHT(PageTable); */
/* THIS IS THE INPUT BUFFER RX0 WILL BE PLACED HERE */

I6 = rx_buf;

/* L6 = LENGTH(InPut); */

L6 = 14000;

M5 = 0;

/* THIS IS THE OUTPUT BUFFER TX0 WILL BE PULLED FROM HERE */

/* L7 = LENGTH(InPut); */

L7 = 14000;

I7 = rx_buf;

AR = DM(Delay);

M7 = AR;

MODIFY(I7,M7);

IMASK = 0x0071; LOOPER:

nop;

IDLE;

nop;

JUMP LOOPER;

/* End the test program */
/******************************************************************************

*

* CODEC stops IRQ and auto-buffering; codecInit require afterward.

*

* REGISTER USAGE SUMMARY:

*

* Input : ar, ax0, ay0

* Update : imask

* Output : none

* Destroy: none

* Keep : none

* Memory : none

* Calls : none

*

******************************************************************************/

.section/pm seg_code;

CodecStop:

imask = 0x0001;

ax0 = 0;

dm (SPORT0_Autobuf) = ax0;

dm (SPORT0_Control_Reg) = ax0;
ax0 = dm (System_Control_Reg);

ay0 = b#1110111111111111;

/* +-/!||+-----/+-/- | Program memory wait states

| !||| | 0

| !||| |

| !||+---------- 0

| !|| 0

| !|| 0

| !|| 0

| !|| 0

| !|| 0

| !|| 0

| !|+----------- SPORT0 1=serial port, 0=FI, FO, IRQ0, IRQ1,..

| !+------------ SPORT0 1=enabled, 0=disabled

| +============= SPORT0 1=enabled, 0=disabled

+---------------- 0

0

0

*/

ar = ax0 and ay0;

dm (System_Control_Reg) = ar;

rts;

/* /////////////// END codecStop //////////////////////////////////////////// */
/******************************************************************************

*

* CODEC initialization routine.

*

* REGISTER USAGE SUMMARY:

*

* Input : none

* Update : none

* Output : none

* Destroy: ar, af, ax0, ay0, i5, m5, l5, i6, l6, i7, l7,

* Keep : none

* Memory :

* variables:

* dm(stat_flag)

* dm(tx_buf)

* dm(rx_buf)

* dm(init_cmds)

*

* memory mapped control registers:

* dm (SPORT0_Autobuf)

* dm (SPORT0_RFSDIV)

* dm (SPORT0_SCLKDIV)

* dm (SPORT0_Control_Reg)

* dm (SPORT0_TX_Channels0)

* dm (SPORT0_TX_Channels1)

* dm (SPORT0_RX_Channels0)

* dm (SPORT0_RX_Channels1)

* dm (System_Control_Reg)

* Calls : none

******************************************************************************/

.section/pm seg_code;

CodecInit:

/* Shut down sport 0 during re-initialization */

call CodecStop;
ifc = b#00000011111110; /* Clear pending interrupt */

nop;

/* 1. Configure for external SCLK */

ax0 = dm(SPORT0_Control_Reg);

ay0 = b#1011111111111111;

/* |

+---------------ISCLK bit
1=internal 0=external clock

*/

ar = ax0 and ay0;

dm(SPORT0_Control_Reg) = ar;
/* 2. Serial Word length = 16 bits */

ax0 = dm(SPORT0_Control_Reg);

ay0 = b#0000000000001111;

/* ----

|

+--Serial word length (SWL = SLEN - 1) */

ar = ax0 or ay0;

dm(SPORT0_Control_Reg) = ar;
/* 3. Transmit and Receive Frame syncs required with every word */

ax0 = dm(SPORT0_Control_Reg);

ay0 = b#0010100000000000;

/* | |

| +-------------TX Frame sync
1=every word 0=first word

|

+---------------RX Frame sync
1=everyword 0=first word */

ar = ax0 or ay0;

dm(SPORT0_Control_Reg) = ar;
/* 4. Receive Frame sync is an input to the DSP */

ax0 = dm(SPORT0_Control_Reg);

ay0 = b#1111111011111111;

/* |

+----------Internal RX frame sync
1=output 0=input to DSP */

ar = ax0 and ay0;

dm(SPORT0_Control_Reg) = ar;
/* 5. Transmit frame sync is an:

Input- in frame sync loopback mode

Output-in nonframe synce loopback mode */

ax0 = dm(SPORT0_Control_Reg);

ay0 = b#0000001000000000;

/* |

+----------Internal TX frame sync
1=output 0=input to DSP */

ar = ax0 or ay0;

dm(SPORT0_Control_Reg) = ar;
/* 6. Frame synces occur one SCLK cycle before the MSB
of the serial word */

ax0 = dm(SPORT0_Control_Reg);

ay0 = b#1110101111111111;

/* | |

| +-----------Normal transmit
framing 0=normal 1=alternate

+-------------normal receive
framing 0=normal 1=alternate */

ar = ax0 and ay0;

dm(SPORT0_Control_Reg) = ar;
/* 7. Frame syncs are active high */

ax0 = dm(SPORT0_Control_Reg);

ay0 = b#1111111100111111;

/* ||

|+-------Receive
frame sync active 0=high 1=low

+--------Transmit
frame sync active 0=high 1=low */

ar = ax0 and ay0;

dm(SPORT0_Control_Reg) = ar;
/* turn autobuffering off */

ax0 = dm(SPORT0_Autobuf);

ay0 = b#1111111111111100;

/* ||

|+-------RX
autobuffering 1=enabled 0=disabled

+--------TX
autobuffering 1=enabled 0=disabled */

ar = ax0 and ay0;

dm(SPORT0_Autobuf) = ar;
/*============== S Y S T E M A N D M E M O R Y S T U F F ==============*/

ax0 = b#0001000000000000;

/* +-/!||+-----/+-/- | program memory wait states

| !||| | 0

| !||| |

| !||+---------- 0

| !|| 0

| !|| 0

| !|| 0

| !|| 0

| !|| 0

| !|| 0

| !|+----------- SPORT1 1=serial port, 0=FI, FO, IRQ0, IRQ1,..

| !+------------ SPORT1 1=enabled, 0=disabled

| +============= SPORT0 1=enabled, 0=disabled

+---------------- 0

0

0

*/

ay0 = dm (System_Control_Reg);

ar = ax0 or ay0;

dm (System_Control_Reg) = ar;
/* Initialize the CODEC by setting its control registers */ i7 = InitCommands;

/*****************************************

* Circular buffers are not implemented yet

* l7 = LENGTH(InitCommands);

******************************************/

l7 = 0x10; /*16*/

/* Fixup for now */

m5 = 1;

ax0 = 1;

dm(TX_InitEnable) = ax0;

ax0 = InitCommands;

ax0 = dm(i7,m5);

tx0 = ax0; /* Disable interrupt nesting */

ICNTL = 2;
/* Enable transmit interrupt */

imask = b#0001110001;

/* |||||||||+ | timer

||||||||+- | SPORT1 rec or IRQ0

|||||||+-- | SPORT1 trx or IRQ1

||||||+--- | BDMA

|||||+---- | IRQE

||||+----- | SPORT0 rec

|||+------ | SPORT0 trx

||+------- | IRQL0

|+-------- | IRQL1

+--------- | IRQ2

*/
check_init:

AR = dm(TX_InitEnable);

NONE = pass AR;

if ne jump check_init;

rts;

/* //////////////////////////////// END InitCodec ////////////////////////////
*/
/*****************************************************************************

*

*

*

*

******************************************************************************/
/*------------------------------------------------------------------------------

-

- Transmit interrupt used for Codec initialization

-

- REGISTER USAGE SUMMARY:

-

- Input : M5 = 1

- Update : I7

- Output : TX0

- Destroy: none (second register bank)

- Keep : none

- Memory : DM(TX_InitEnable), DM(Init_Commands)

- Calls : none ------------------------------------------------------------------------------*/

.section/pm seg_code;

SPORT0_tx_int_handler:

ENA SEC_REG;

AR = DM(TX_InitEnable);

AR = PASS AR;

IF EQ RTI;

AX0 = DM(I7, M5); /* Fetch next control word and */

TX0 = AX0;

AX0 = I7;

AY0 = InitCommands;

AR = AX0 - AY0;

IF NE RTI; /* RTI if more control words still
waiting */

AX0 = 0; /* Else set done flag and
*/

DM(TX_InitEnable) = AX0; /* Reset status flag */

RTI;

/* ////////////////////////// END SPORT0 TX INTERRUPT /////////////////////////
*/
/*------------------------------------------------------------------------------

-

- Recieve interrupt used for Codec initialization

-

- REGISTER USAGE SUMMARY:

-

- Input : I1 = PageTable, RX0

- Update : I1, I6, I7, M5, M6, _AX0, _AR

- Output : TX0

- Destroy: none (second register bank)

- Keep : none

- Memory : DM(INPUT)

- Calls : none ------------------------------------------------------------------------------*/

.section/pm seg_code;

SPORT0_rx_int_handler:

DM(rx_buf)=Rx0;

ENA SEC_REG;

M5 = 0;

M6 = 0;

AR = DM(I1, M1);

DMOVLAY_AR2: nop; /* DMOVLAY = AR; */

NONE = PASS AR; /* set the page register to table
entry*/

IF ne JUMP fill;

M5 = 1;

M6 = 1;

fill:

AX0 = RX0;

DM(I6,M5) = AX0;
AX0 = DM(I7,M6);

TX0 = AX0;

RTI;

/* ////////////////////////// END SPORT0 RX INTERRUPT /////////////////////////
*/ ---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger





(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )

Re: talkthrough initilization - Mike Rosing - Sep 29 1:57:00 2003

Howdy Ryfat,

I think part of your project is to learn something about the art of
debugging. So the first step to take is to make the talk thru work
with just the 16 word buffer. No delay basicly, every word that comes in
you send out right away. Once you get that to work, you know that the
hardware is doing what you expect. And if you can't get even that to
work, you know you're doing something seriously wrong, or there's
something seriously wrong with your hardware.

Before you get the talk thru part to work, break the input and output
problems into 2 problems. Feed a pure sine wave or square wave to your
input. A square wave will tell you something about how the hardware works
because you can compare the voltage to the numbers in ram. Then
try to generate a square wave and send it to the output. When you can do
the two problems of input and output separatly, you'll have a better idea
of what's going wrong when you stick them together.

What have you gotten to work so far?

Patience, persistence, truth,
Dr. mike




(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )

RE: talkthrough initilization - Dave Tiefenbrunn - Sep 29 13:18:00 2003

Rýfat Yazgan from Turkey wrote:

>I want to ask you what changes I ve to do on software, hardware and codec to
run
>the program correctly with microphone.

>I ve a normal computer microphone and speakers(they have own amplifiers)If you
>know the answer please help me

The "normal computer microphones" I have seen need a DC bias voltage to power
their internal pre amplifiers. The EZ-KIT does not provide this voltage, so the
mic would not produce a signal.

Dave

David Tiefenbrunn N1WWY
Essential Telecommunications Corp. - http://www.essentialtel.com
David Tiefenbrunn - http://users.abac.com/dandatief





(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )