Hello,
I am very new to TI and just started using the TMS320C6713 DSP Starter Kit.
I started with the "Hello World" example given in the "DSP and Applications" book by Rulph Chassaing. I want to turn an LED on and hear a SINE wave when the DIP switch is turned on. I have pasted the code below.
The problem is when the program goes inside the "output_left_sample()" it never returns. This is because, I am using the polling method (poll=1) and "while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE)" always says that the channel is busy. So program goes into infinite loop.
What might be the reason that this is happening?
The status of the DIP switch is correctly recognized. I am able to see the LED go ON and OFF based switch position. I am posting the main(), comm_poll() and output_left_sample() below. Let me know if I have to upload the entire project.
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 DIP switch #0 pressed
{
DSK6713_LED_on(0); //turn LED #0 ON
output_left_sample(sine_table[loopindex++]*gain); //output sample
if (loopindex >= LOOPLENGTH) loopindex = 0; //reset table index
}
else DSK6713_LED_off(0); //turn LED off if not pressed
} //end of while(1) infinite loop
}
void output_left_sample(short out_data) //for output from left channel
{
AIC_data.uint=0; //clear data structure
AIC_data.channel[LEFT]=out_data; //data from Left channel -->data structure
if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));//if ready to transmit - CONDITION IN WHILE ALWAYS TRUE
MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//output left channel
}
void comm_poll() //added for communication/init using polling
{
poll=1; //1 if using polling
c6713_dsk_init(); //init DSP and codec
}