This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TLV320AIC23B

Other Parts Discussed in Thread: TLV320AIC23B

Hello everybody,

 

I'm using a Spectrum Digital evaluation board, the DSK6482 ( http://c6000.spectrumdigital.com/dsktci6482/ ). This board features a TLV320AIC23B codec ( http://focus.ti.com/docs/prod/folders/print/tlv320aic23b.html ) which is connected to the TCI6482 with I2C (control) and McBSP1 (sample data)

I'm interfacing to this AIC23B with the DSK's board support library (BSP).

Uint32 scratch;
Void main()
{
DSKTCI6482_init();
hCodec = DSKTCI6482_AIC23_openCodec(0, &some_codec_parameters);

while(1) {
    while (!DSKTCI6482_AIC23_read32(hCodec, &scratch));
    while (!DSKTCI6482_AIC23_write32(hCodec, scratch));

    }
}

As you can see, the BSP library uses the polling method of reading and writing signals. The codec is configured to sample signals at 48 kHz (both ADC and DAC) with input bit length of 16 bit (i.e. not 20 bit, not 24 bit, not 32 bit,... but 16 bit). Using above sample code, I can sample a stereo signal via Line-In and have it returned in stereo on my headphones. So far so good.

The problem starts when I want to do any signal processing with my sample (i.e. the "scratch" variable) and have it returned. Whenever I do even the most basic operations on the sample (such as bitmasking and bitshifting) I get nonsense noise, or heavily distorted signals or silence as output.

Having a look at the codec's data manual ( SLWS106H ), Figure 3-8 explains how McBSP sample transmission/reception works: In my case it should be "16-bit left channel, 16-bit right channel, 16-bit left channel, 16-bit right channel ..." etc.

Now, doing bitmasking,

    while (!DSKTCI6482_AIC23_read32(hCodec, &scratch));
    scratch = scratch & 0xffff0000;
    while (!DSKTCI6482_AIC23_write32(hCodec, scratch));

I should get a left-only signal on my headphones. Instead, I get silence.

....

When I do this:

    while (!DSKTCI6482_AIC23_read32(hCodec, &scratch));
    scratch = scratch & 0x0000ffff;
    while (!DSKTCI6482_AIC23_write32(hCodec, scratch));

I should get a right-only signal on my headphones. Instead, now the left and right channel are switched.

So basically I think I made a mistake in my assumption about the data layout in the DRR and DXR registers, and maybe also in the way my 16-bit signals are transmitted along the McBSP. I tried different bitmasks (0x0f0f0f0f, 0x00ff00ff etc.) and bitshifts, but I cannot see any patterns behind the changed signals - usually it turns out to be distorted and near-noise.

The problems already start with the TLV320AIC23B data manual. It doesn't explain how the sampled data is represented on the McBSP: is it PCM, is it "two's complement", is it sign-extended etc.

 

Your ideas are happily appreciated!

Thanks, Jerry

 

  • Hi Jerry

    The digital data is in 2's complement format. Now try masking according to 2s complement format and see if there are any differences. If not then let me know.

  • I thought i got the same problem. I am using the board TMS320C6713. And there is a Aic23B on the board. I got a sample code like followed :

    #include "dsk6713.h"
    #include "dsk6713_aic23.h"
    #include "stdlib.h"
    #include "math.h"

    // Codec configuration settings
    DSK6713_AIC23_Config config = { \
    0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */ \
    0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
    0x01f9, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */ \
    0x01f9, /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */ \
    0x0011, /* 4 DSK6713_AIC23_ANAPATH Analog audio path control */ \
    0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path control */ \
    0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */ \
    0x0043, /* 7 DSK6713_AIC23_DIGIF Digital audio interface format */ \
    0x0001, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */ \
    0x0001 /* 9 DSK6713_AIC23_DIGACT Digital interface activation */ \
    };

    void main()
    {
    DSK6713_AIC23_CodecHandle hCodec;
    Uint32 readval;

    // Initialize BSL
    DSK6713_init();

    //Start codec
    hCodec = DSK6713_AIC23_openCodec(0, &config);

    // Set frequency to 8KHz
    DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_8kHZ);

    for(;;)
    {

    // Read sample from the left channel
    while (!DSK6713_AIC23_read(hCodec, &readval));

    while (!DSK6713_AIC23_write(hCodec, readval));

    }

    // DSK6713_AIC23_closeCodec(hCodec); // Codec close is unreachable
    }

    With this code i got two Different output Signal. But i can't find the relationship between the Signal and the Bits. 

    Following is the Data:

    Name : readval
    Default:55154
    Hex:0x0000D772
    Decimal:55154
    Octal:0153562
    Binary:00000000000000001101011101110010

    Name : readval
    Default:4096
    Hex:0x00001000
    Decimal:4096
    Octal:010000
    Binary:00000000000000000001000000000000

    It seems that, my Binary will not depended on the signal. Could you please tell me why? I really want to know, what does this Binary mean.

    Thx a lot.