I facing some problem I need your kind help.
1. Can u tell me whether it accepts -ve value of input voltage in the AIC23, & stores it as -ve value & displays it as -ve value while printf. Bcoz in the following code given below & its output dont have any -ve values while printing the sampled data.
2. The print in the while loop is non reliable sometimes it prints sometime does not print at all, some prints with step jump (i.e. missing printf in some loop). sample op is given below.
3. In this program if i restart or run it again it shows different unknown errors. Every time I need to reload the program & run it for successful operation.This should not happen.
CODE is given below: Note: dont worry about the function & other declarations the function has been removed to take less area to paste it here. Only main has been given. If u ask I can provide u the full code. While running the Line was connected to PC & music file was being played. Program is designed to run continuously with while (1) ,but for debugging purpose code has been made for while(p<1000)
Thank You for getting around with it.
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 leftsample,rightsample;
int i=0,j=0,p=0;
double x[SIZE];
double y[SIZE];
double w[SIZE];
printf("******** N & SIZE %d %d ********\n",N-1,SIZE);
for(i=0;i<SIZE;i++)
{
x[i]=0;
y[i]=0;
}
i=0;
gen_w_r2(w, N);
DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0, &config);
DSK6713_AIC23_setFreq(hCodec,DSK6713_AIC23_FREQ_8KHZ);
while(p<1000)
{
while (!DSK6713_AIC23_read(hCodec,&leftsample)); /* Read a sample to the left channel */
while (!DSK6713_AIC23_read(hCodec,&rightsample));
x[2*i]=leftsample;
x[2*i+1]=0;
while (!DSK6713_AIC23_write(hCodec,y[2*i])); /* Write a sample to the left channel */
while (!DSK6713_AIC23_write(hCodec,y[(2*i)+1]));
if(i==N-1)
{
for(j=0;j<SIZE;j++)
{
y[j]=x[j];
}
printf("p = %d",p);
DSPF_dp_icfftr2(N, y, w, 1);
bit_rev(y, N);
divide(y, N);
/*//for transmitter omitted part
DSPF_dp_cfftr2(N, y, w, 1);
bit_rev(y, N); */
i=-1;
}
i++;p++;
}
// for debugging
for (j=0;j<32;j++)
{ printf("input %d %f + %f ,",j+1,x[2*j],x[(2*j)+1]);
}
/* Close the codec */
DSK6713_AIC23_closeCodec(hCodec);
}