DSPRelated.com
Forums

Problem with AIC23 Codec of TMS320DM642 board

Started by liti...@yahoo.com May 28, 2012
Hello every one. I'm a beginner. I'm using TMS320DM642 board with CCS 3. I want to use AIC23 Codec for some DSP algorithms.
My problem is when I read each block of 100 PCM sapmles then wrote them to codec data port, I didn't hear anything from my headphone.
If I read one sample and wrote it to codec data port immediately, it worked.
If I read every 2 samples and wrote them to codec data port, it worked but there was so much noise.

Please give me some advice. Thank you very much.
these are my excerpts of code:
----------------------------
int main()
{
EVMDM642_AIC23_CodecHandle hCodec1;
int i;
Uint32 InpBuffer[100];
Uint32 OutBuffer[100];

EVMDM642_init();
hCodec1 = EVMDM642_AIC23_openCodec(0, &config, EVMDM642_AIC23_INPUT | EVMDM642_AIC23_OUTPUT );
EVMDM642_AIC23_setFreq(hCodec1, 8000);

while (1)
{
for (i = 0; i < 100; i++)
EVMDM642_AIC23_read32(hCodec1, &InpBuffer[i]);
for (i = 0; i < 100; i++)
OutBuffer[i] = InpBuffer[i];
for (i = 0; i < 100; i++)
while(!EVMDM642_AIC23_write32(hCodec1, OutBuffer[2]));
}
}
------------------------------
------------------------------
int main()
{
EVMDM642_AIC23_CodecHandle hCodec1;
int i;
Uint32 Sample;

EVMDM642_init();
hCodec1 = EVMDM642_AIC23_openCodec(0, &config, EVMDM642_AIC23_INPUT | EVMDM642_AIC23_OUTPUT );
EVMDM642_AIC23_setFreq(hCodec1, 8000 );

while (1)
{
EVMDM642_AIC23_read32(hCodec1, &Sample);
while(!EVMDM642_AIC23_write32(hCodec1, Sample));
}
}
------------------------------
------------------------------
int main()
{
EVMDM642_AIC23_CodecHandle hCodec1;
int i;
Uint32 InpBuffer[2];
Uint32 OutBuffer[2];

EVMDM642_init();
hCodec1 = EVMDM642_AIC23_openCodec(0, &config, EVMDM642_AIC23_INPUT | EVMDM642_AIC23_OUTPUT );
EVMDM642_AIC23_setFreq(hCodec1, 8000 );

while (1)
{
EVMDM642_AIC23_read32(hCodec1, &InpBuffer[0]);
EVMDM642_AIC23_read32(hCodec1, &InpBuffer[1]);
while(!EVMDM642_AIC23_write32(hCodec1, InpBuffer[0]));
while(!EVMDM642_AIC23_write32(hCodec1, InpBuffer[1]));
}
}
------------------------------
------------------------------

_____________________________________
what if u increase the sampling rate from 8000 up to higher one in the following line.. ?
EVMDM642_AIC23_setFreq(hCodec1, 8000 );

Hello every one. I'm a beginner. I'm using TMS320DM642 board with CCS 3. I want to use AIC23 Codec for some DSP algorithms.
>My problem is when I read each block of 100 PCM sapmles then wrote them to codec data port, I didn't hear anything from my headphone.
>If I read one sample and wrote it to codec data port immediately, it worked.
>If I read every 2 samples and wrote them to codec data port, it worked but there was so much noise.
>
>Please give me some advice. Thank you very much.
>these are my excerpts of code:
>----------------------------
>int main()
>{
> EVMDM642_AIC23_CodecHandle hCodec1;
> int i;
> Uint32 InpBuffer[100];
> Uint32 OutBuffer[100];
>
> EVMDM642_init();
> hCodec1 = EVMDM642_AIC23_openCodec(0, &config, EVMDM642_AIC23_INPUT | EVMDM642_AIC23_OUTPUT );
> EVMDM642_AIC23_setFreq(hCodec1, 8000);
>
> while (1)
> {
> for (i = 0; i < 100; i++)
> EVMDM642_AIC23_read32(hCodec1, &InpBuffer[i]);
> for (i = 0; i < 100; i++)
> OutBuffer[i] = InpBuffer[i];
> for (i = 0; i < 100; i++)
> while(!EVMDM642_AIC23_write32(hCodec1, OutBuffer[2]));
> }
>}
>------------------------------
>------------------------------
>int main()
>{
> EVMDM642_AIC23_CodecHandle hCodec1;
> int i;
> Uint32 Sample;
>
> EVMDM642_init();
> hCodec1 = EVMDM642_AIC23_openCodec(0, &config, EVMDM642_AIC23_INPUT | EVMDM642_AIC23_OUTPUT );
> EVMDM642_AIC23_setFreq(hCodec1, 8000 );
>
> while (1)
> {
> EVMDM642_AIC23_read32(hCodec1, &Sample);
> while(!EVMDM642_AIC23_write32(hCodec1, Sample));
> }
>}
>------------------------------
>------------------------------
>int main()
>{
> EVMDM642_AIC23_CodecHandle hCodec1;
> int i;
> Uint32 InpBuffer[2];
> Uint32 OutBuffer[2];
>
> EVMDM642_init();
> hCodec1 = EVMDM642_AIC23_openCodec(0, &config, EVMDM642_AIC23_INPUT | EVMDM642_AIC23_OUTPUT );
> EVMDM642_AIC23_setFreq(hCodec1, 8000 );
>
> while (1)
> {
> EVMDM642_AIC23_read32(hCodec1, &InpBuffer[0]);
> EVMDM642_AIC23_read32(hCodec1, &InpBuffer[1]);
> while(!EVMDM642_AIC23_write32(hCodec1, InpBuffer[0]));
> while(!EVMDM642_AIC23_write32(hCodec1, InpBuffer[1]));
> }
>}
>------------------------------
>------------------------------
>
>_____________________________________

_____________________________________
system,

first, you need to read/examine the coding example(s) that come with the CCS
regarding how to do double buffering, interrupts, and how to use the EDMA
peripheral and McBSP peripherals.

Then you need to read the example of how to setup the aic23; a document
available on the TI web site.

Then, if it were me, I would first implement the coding examples, learn just how
they work, then you can experiment on variations
R. Williams
---------- Original Message -----------
From: s...@gmail.com
To: c...
Sent: Mon, 25 Nov 2013 04:35:59 -0500
Subject: [c6x] Re: Problem with AIC23 Codec of TMS320DM642 board

> what if u increase the sampling rate from 8000 up to higher one in the
> following line.. ? EVMDM642_AIC23_setFreq(hCodec1, 8000 );
>
> Hello every one. I'm a beginner. I'm using TMS320DM642 board with CCS
> 3. I want to use AIC23 Codec for some DSP algorithms.
> >My problem is when I read each block of 100 PCM sapmles then wrote them to
codec data port, I didn't hear anything from my headphone.
> >If I read one sample and wrote it to codec data port immediately, it worked.
> >If I read every 2 samples and wrote them to codec data port, it worked but
there was so much noise.
> >
> >Please give me some advice. Thank you very much.
> >these are my excerpts of code:
> >----------------------------
> >int main()
> >{
> > EVMDM642_AIC23_CodecHandle hCodec1;
> > int i;
> > Uint32 InpBuffer[100];
> > Uint32 OutBuffer[100];
> >
> > EVMDM642_init();
> > hCodec1 = EVMDM642_AIC23_openCodec(0, &config, EVMDM642_AIC23_INPUT |
EVMDM642_AIC23_OUTPUT );
> > EVMDM642_AIC23_setFreq(hCodec1, 8000);
> >
> > while (1)
> > {
> > for (i = 0; i < 100; i++)
> > EVMDM642_AIC23_read32(hCodec1, &InpBuffer[i]);
> > for (i = 0; i < 100; i++)
> > OutBuffer[i] = InpBuffer[i];
> > for (i = 0; i < 100; i++)
> > while(!EVMDM642_AIC23_write32(hCodec1, OutBuffer[2]));
> > }
> >}
> >------------------------------
> >------------------------------
> >int main()
> >{
> > EVMDM642_AIC23_CodecHandle hCodec1;
> > int i;
> > Uint32 Sample;
> >
> > EVMDM642_init();
> > hCodec1 = EVMDM642_AIC23_openCodec(0, &config, EVMDM642_AIC23_INPUT |
EVMDM642_AIC23_OUTPUT );
> > EVMDM642_AIC23_setFreq(hCodec1, 8000 );
> >
> > while (1)
> > {
> > EVMDM642_AIC23_read32(hCodec1, &Sample);
> > while(!EVMDM642_AIC23_write32(hCodec1, Sample));
> > }
> >}
> >------------------------------
> >------------------------------
> >int main()
> >{
> > EVMDM642_AIC23_CodecHandle hCodec1;
> > int i;
> > Uint32 InpBuffer[2];
> > Uint32 OutBuffer[2];
> >
> > EVMDM642_init();
> > hCodec1 = EVMDM642_AIC23_openCodec(0, &config, EVMDM642_AIC23_INPUT |
EVMDM642_AIC23_OUTPUT );
> > EVMDM642_AIC23_setFreq(hCodec1, 8000 );
> >
> > while (1)
> > {
> > EVMDM642_AIC23_read32(hCodec1, &InpBuffer[0]);
> > EVMDM642_AIC23_read32(hCodec1, &InpBuffer[1]);
> > while(!EVMDM642_AIC23_write32(hCodec1, InpBuffer[0]));
> > while(!EVMDM642_AIC23_write32(hCodec1, InpBuffer[1]));
> > }
> >}
> >------------------------------
> >------------------------------
> >
> >_____________________________________
> >
> >
------- End of Original Message -------

_____________________________________