DSPRelated.com
Forums

CODEC problems 5402dsk

Started by Alex Bluett March 23, 2004
I need to write out a sine wave to the codec then read it back in.
There are loads of examples that show how to read in through the
codec then write it out, but not the other way around. I tryed
changing round the codec example but it didnt work. My code uses
timer interrupts, i have them set up and working but i cannot get
the codec to write out.

This is the code so far, the codec has been set up in 15 bit mode
and at a sample frequency of 16000. There are two different ways i
have tried.
I am struggling with this and any help would be greatly appreciated.
Oh yeah, the board i am using is TMS320VC5402 and the codec that is
on there is the TLC320AD50c.

interrupt void timerIsr(void)
{
TIMER_stop(mhTimer);

w = 10

output =(sin(time*w)); /*output multiplyed by (2^16/2)*/
/*so DAC/ADC can use it */

temp =(32767)*output; /*Store output as a signed int */ /*Write temp to DAC for that instance*/
*(volatile s16*)DXR1_ADDR(HANDSET_CODEC) = temp; //if (codec_write(hHandset, pbuf, count) == OK)
//{
// puts("sample written\n\n");
//} //if (codec_read(hHandset, pbuf2, count) == OK)
//{
// puts("sample read\n\n");
//}

/*May need a loop to delay slightly before reading input*/

/*Read temp2 from ADC for that instance*/
temp2 = *(volatile s16*)DRR1_ADDR(HANDSET_CODEC); temp3 = temp2/(32767);

input = temp3;
/*increment counter and time*/
time = 0.01+time;
++timer_int_cnt; TIMER_start(mhTimer);
}