DSPRelated.com
Forums

McBSP is not ready to transmit

Started by amit...@gmail.com February 29, 2008
This is a basic program from Rulph Chassing book
//Sine8_LED.c Sine generation with DIP switch control

#include "dsk6713_aic23.h" //support file for codec,DSK

Uint32 fs = DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
short loop = 0; //table index
short gain = 10; //gain factor
short sine_table[8]={0,707,1000,707,0,-707,-1000,-707};//sine values

void main()
{
comm_poll(); //init DSK, codec, McBSP
DSK6713_LED_init(); //init LED from BSL
DSK6713_DIP_init(); //init DIP from BSL

while(1) //infinite loop
{
if(DSK6713_DIP_get(0)==0) //=0 if switch #0 pressed
{
DSK6713_LED_on(0); //turn LED #0 ON
output_sample(sine_table[loop]*gain); //output every Ts (SW0 on)

if (++loop > 7) loop = 0; //check for end of table

}

else DSK6713_LED_off(0); //LED #0 off
} //end of while (1)
} //end of main
We debug the program using rel time emulation and we are getting following result. When DIP Switch # 0 is pressed, following sequence of statements are executed,

DSK6713_LED_on(0); //turn LED #0 ON
output_sample(sine_table[loop]*gain); //output every Ts (SW0 on)

The last function is defined in "c6713dskinit.c" file. After this following sequence of statements are executed,

short CHANNEL_data;
AIC_data.uint=0; //clear data structure
AIC_data.uint=out_data; //32-bit data -->data structure
CHANNEL_data=AIC_data.channel[RIGHT]; //swap left and right channels
AIC_data.channel[RIGHT]=AIC_data.channel[LEFT];
AIC_data.channel[LEFT]=CHANNEL_data;
if (poll)
while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE)); //if ready to transmit
MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint); //write/output data

Now, at second last statement, program enters in infinite loop, That means McBSP is never ready to transmit. Because of this we are not able to see sine wave on DSO.
Please help me if anyone knows something about it.....
Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution for Commercial & Consumer End Equipment: www.ti.com/dm6467