DSPRelated.com
Forums

What is wrong in initialization codec in C5402 DSK

Started by bakhtvar February 17, 2002
Hello all;
I bought C5402 DSK and wrote this code to initialize McBSP1 for AD50

#include <stdio.h>
#include <mcbsp54.h>

/* global functions */
extern int init_54x();
extern void wait(unsigned int N);

void main()
{
int codec_ctrl_data[4];
int i;

/* Initialize DSP */
init_54x();

mcbsp_init(1,
0x0000, // disable rx
0x0000, // disable tx, FREE=1
0x0040, // 1 word/frame, 16-bit/word
0x0000, // 1 rx phase, no compand
0x0040, // 1 word/frame, 16-bit/word
0x0000, // 1 tx phase, no compand
0,0,0,0,0,0,0,0, // all are disabled
0x000c); // external FS and CLK, tx on rising edge,rx on
falling
wait(200);

MCBSP_SUBREG_WRITE(1, SPCR1_SUBADDR, 0x0001); // enable rx
MCBSP_SUBREG_WRITE(1, SPCR2_SUBADDR, 0x0201); // enable tx

wait(200);

codec_ctrl_data[0]=0x0100;
codec_ctrl_data[1]=0x0200;
codec_ctrl_data[2]=0x0300;
codec_ctrl_data[3]=0x0400;
for(i=0; i < 4; i++)
{
SET_REG(DXR11, 0x0001); // primary comm data to request a
secondary comm

(***) while( !MCBSP_XRDY(1)); // primary data in DXR1x reg, wait
for XRDY flag

SET_REG(DXR11, codec_ctrl_data[i]); //secondary data

while( !MCBSP_XRDY(1)); // secondary data in DXR1x reg, wait
for XRDY flag
}
SET_REG(DXR11, 0x0000); //flush last word tx'd from DXR1
while(1);
}

but when I run it it hangs at line (***). this means that it can't
flush DXR11 register.
please help me.
Thnaks