DSPRelated.com
Forums

Re: FW: Re: reading values from aic23d codec in c6713 dsk

Started by Jeff Brower February 15, 2007
Pablo-

> what I mean whith SOUND, is just that, a noise going out from
> the two loudspeakers.

What "noise"? Sine wave? Buzz? Static? To solve engineering problem, you need to
be clear and specific, otherwise no one can read your mind and give you help.

> I am using the classic computer loudspeakers plugged to the
> OUTPUT pin. You know, they have a jack connector which goes directly from one of
> the loudspeakers, while the other one connects only whith this first.

Ok, but did you carefully check the connectors? The typical PC sound output is a
*stereo* connector, but the DSK connectors are per channel (mono). You see four
audio connectors on the DSK, right? Compare that to the PC and think about it.

I think you're being careless and simply have a wiring problem. You need to debug
this very carefully -- use your ohm meter, scope, read the schematic, and do some
"hands-on, in the lab" engineering. Class and online tech groups can't teach you
everything.

-Jeff
> -
> From: Jeff Brower
> To: Pablo L.Sordo Martez
> CC: c...
> Subject: Re: FW: Re: [c6x] reading values from aic23d codec in c6713 dsk
> Date: Tue, 13 Feb 2007 16:34:43 -0600
>
> Pablo-
> I have followed your advices again and I have
> kept the second DSK6713_AIC23_write();. The results haven't
> been what you told me. I have thought that the problem might be
> in hardware. I am using loudspeakers (left and right) to hear
> the "sounds" from the board. So, withe the changes you
> suggested me, I expected to hear noise in lefch and nothing in
> rightch. Unfortunately, I hear sound by both and I don't
> understand why.
>
> 1) Does loudspeakers separate sound of the two channels, I
> mean, rightch matches with right loudspeaker and lefch matches
> with left one?? (I add the code)
>
> The code below looks Ok to me. What do you mean by "sound" -- a sine
> wave? And if so, do you hear it as pure and non-distored? What is the
> frequency if you measure it with a scope? Are the 2 channels identical?
> 2) Can I produce a song with CCS and reproduce it with AIC23??
>
> Sure, store it ahead of time in SDRAM memory and treat it like the sine
> table when code runs. At 8 kHz sampling rate, 16 Mbyte of SDRAM would
> give you 16 min of music, 4 min at 32 kHz sampling rate, etc. But you
> need to make sure the .wav file or other source contains data with
> sampling rate that matches what you program the AIC23B, otherwise you
> will hear distortion.
> 3) Why is neccesary to use while (!DSK6713_AIC23_write( , ));
> instead of DSK6713_AIC23_write( , );?? What are the
> differences??
>
> You have to wait for the AIC23B to be ready to accept the next sample.
> If you put a counter inside:
>
> wait_count = 0;
> while (!DSK6713_AIC23_write(...)) {
> wait_count++
> }
>
> then you can see it takes a while to "consume" the sampling period and be
> ready to output the next sample.
>
> -Jeff
> void main()
> {
> DSK6713_AIC23_CodecHandle hCodec;
> [...]
> /* Start the codec */
> hCodec = DSK6713_AIC23_openCodec(0, &config);
>
> while(DSK6713_DIP_get(0)==1)
> { /* Generate a 1KHz sine wave for 5 seconds */
> for (msec = 0; msec < 5000 ; msec++)
> { for (sample = 0; sample < SINE_TABLE_SIZE; sample++)
> { leftch = sinetable[sample];
> rightch=0x00000000;
>
> while (!DSK6713_AIC23_write(hCodec, leftch)); /*
> write left ch */
> while(!DSK6713_AIC23_write(hCodec, rightch)); /*
> write right ch */
> }
> }
>
> } [...]
>
> 2) Can I produce a song with CCS and reproduce it with AIC23??
> 3) Why is neccesary to use while (!DSK6713_AIC23_write( , ));
> instead of DSK6713_AIC23_write( , );?? What are the
> differences??
>
> Thanks in advance,
>
> Pablo L.
> -----------------
> From: Jeff Brower
> To: Pablo L.Sordo Martez
>
> CC: c...
> Subject: Re: FW: Re: [c6x] reading values from aic23d
> codec in c6713 dsk
> Date: Thu, 08 Feb 2007 15:50:17 -0600
>
> Pablo-
>
> > Jeff, I follow your advice and I got that it
> sounds. However,
> > I have done some changes and tests in order to be
> sure that I understand perfectly
> > the codec working. Unfortunately I don't. My first
> test was to erase this line:
> > while (!DSK6713_AIC23_write(hCodec, rch)); /* write
> right ch */
> > I dissapoint a bit because without this line, the
> sound is still
> > happening, and through the two headphones. I
> expected to hear the noise by only one
> > channel.
> > Why this happen??
>
> With only one line, you are alternating writes to
> left and write channels. That cuts
> the sampling rate in half, and also "splits out" on
> two channels what you expect to
> hear on just one channel.
>
> What you should try is keep the second DSK6713_AIC23_
> write() call but set rch to
> zero. Then you should hear "nothing" on the right
> channel.
>
> > I also tried to set masks to the channels registers
> (leftch and
> > rightch) leaving only the first or the last 16 bits
> (I think this is the way to get
> > the two channels values by separate).
> >
> > leftch = sinetable[sample];
> > rightch = -leftch;
> > leftch=(leftch&0x0000FFFF); /*or also
> leftch=(leftch&0xFFFF0000);*/
> >
> > the results are very different with these two
> masks: with the first one
> > (0x0000FFFF) nothing is heard, but the sound does
> appear with the second
> > (0xFFFF0000).
> >
> > Can you explain me why I am really getting with
> these masks and why is the reason
> > of this behaviour??
>
> Even though lch and rch are ints (int32), they only
> contain 16-bit signed codec
> values. To reflect this, the Spectrum Digital APIs
> should be called:
>
> DSK6713_AIC23_write16()
> DSK6713_AIC23_read16()
>
> as they are with other DSKs, but unfortunately for
> DSK 6713 they are not.
>
> -Jeff
> > >From: Jeff Brower
> >
> > >To: Pablo L.Sordo Martez
> > >CC: c...
> > >Subject: Re: [c6x] reading values from aic23d
> codec in c6713 dsk
> > >Date: Tue, 06 Feb 2007 11:06:30 -0600
> > >
> > >Pablo-
> > >
> > > > DSK6713_AIC23_CodecHandle hCodec;
> > > > Int16 msec, sample;
> > > > Uint32 leftch, rightch;
> > > >
> > > > (...)
> > > >
> > > > /* Generate a 1KHz sine wave for 5 seconds */
> > > > for (msec = 0; msec < 5000; msec++)
> > > > {
> > > > for (sample = 0; sample < SINE_TABLE_SIZE;
> sample++)
> > > > { leftch=(sinetable[sample]<<16);
> > > > /* Send a sample to the left channel */
> > > > while (!DSK6713_AIC23_write(hCodec, leftch));
> > > >
> > > > rightch=(sinetable[sample]>>16);
> > > > /* Send a sample to the right channel */
> > > > while (!DSK6713_AIC23_write(hCodec, rightch));
> > > > }
> > > > }
> > > >
> > > > I take the 16 bit sample and turn into a 32bit
> variable. As
> > you
> > > > said, lefch has the first 16 bits with the
> value of the sample. On the other
> > hand,
> > > > rightch has the last 16 bits with the value of
> the sample. Is this correct?? I
> > > > don't think so, because I have loaded it on the
> board and it doesn't sound.
> > What is
> > > > the mistake??
> > >
> > >I had written another post to Joshy indicating
> that I was incorrect and 2x 16-bit
> > >reads/writes are needed. Suggest to try this:
> > >
> > >short int i;
> > >int lch, rch;
> > >
> > > while (1) {
> > >
> > > for (i=0; i>
> > > lch = sinetable[i];
> > > rch = -lch;
> > >
> > > while (!DSK6713_AIC23_write(hCodec, lch)); /*
> write left ch */
> > > while (!DSK6713_AIC23_write(hCodec, rch)); /*
> write right ch */
> > > }
> > > }
> > >
> > >You should hear continuous tone on both channels,
> with no static or pops. Each
> > >channel should sound the same, but if you look
> with dig scope, they should be 180
> > out
> > >of phase. Frequency of the tone should be sampling
> rate / length of sine table.
> > For
> > >example if sampling rate is 16 kHz, then you
> should hear 62.5 Hz tone (assuming
> > sine
> > >table length is 256 -- I don't know that offhand).
> Note that if you set the
> > sampling
> > >rate too low, then you won't hear the tone (but
> you can still see it on the
> > scope).
> > >
> > >-Jeff
> > >
> > > >
> > ------------
> ----------
> > > >
> > > > From: Jeff Brower
> > > > To: Joshy Jose
> > > > CC: c...
> > > > Subject: Re: [c6x] reading values from aic23d
> codec in c6713 dsk
> > > > Date: Fri, 02 Feb 2007 14:08:12 -0600
> > > >
> > > > Joshy-
> > > >
> > > > > i need to take values from audio codec in
> c6713 dsk?
> > > > > as there are two lines (left , right)
> microphone input , i need to
> > > > > take values from each line seperately, and
> process it
> > > > > i have tried with the function
> > > > > DSK6713_AIC23_read() available in the dsk but
> i could not successfuly do it
> > > > > i used
> > > > > while (!DSK6713_AIC23_read(hCodec, data ));
> > > > > while (!DSK6713_AIC23_read(hCodec, data ));
> > > > >
> > > > > to get two line values,
> > > > >
> > > > > what is the correct way to do this?
> > > >
> > > > Each call to DSK6713_AIC23_read() should return
> a 32-bit value, with high and
> > low
> > > > words being the 2 channel (line) samples. Check
> this post for some example C
> > code:
> > > >
> > > > http://www.dsprelated.com/groups/c6x/show/
> 6704.php
> > > >
> > > > In your code above, you are actually waiting
> for four (4) values, discarding
> > the
> > > > first 2, and therefore cutting the sampling
> rate in half.
> > > >
> > > > -Jeff