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