I2S with AIC23B

These are my notes for getting the mbed hooked up to an AIC23 (TI I2S audio codec) chip, with the intention of using the mbed as a platform for DSP-based audio effects.  For those not familiar, I2S stands for "inter-IC sound" and is a way for integrated circuits to communicate information about digital sound, which the LPC1768 conveniently has hardware support for.

Here is the specific chip I'm using: http://focus.ti.com/lit/ds/symlink/tlv320aic23b.pdf It contains a stereo ADC and DAC, at up to 96 kHz sampling rate with 24-bit resolution.  It also has a headphone and microphone amp.

I got the TSSOP-28 package, which is actually a SSOP package (it's a "large" TSSOP, which means the lead spacing is .65 mm, which as it happens is SSOP spacing.  Don't know why TI calls it TSSOP).  To use it on my breadboard, I got this SSOP-28 adapter from SparkFun: http://www.sparkfun.com/commerce/product_info.php?products_id=500 If you are afraid of soldering this SSOP package, I recommend SparkFun's SMD soldering tutorial (and the corresponding wick-based method): http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=36  It's not bad if you have a good soldering iron and some experience.

I believe at least a few other people have gotten an I2S device working with the mbed.  Here are the resources for doing so that I've found thus far:

Based on this discussion, I believe that the connections should be as follows:
Name(s) AIC23B Pin mbed Pin
TX_SDA/DIN 4 5
TX_WS/LRCIN 5 6
TX_CLK/BCLK 3 7
RX_SDA/DOUT 6 8
RX_WS/LRCOUT 7 29
RX_CLK/BCLK 3 30
Also, the power needs to be hooked up: BVDD, HPVDD, AVDD, DVDD to 3V3 (pin 40 on mbed) and HPGND, AGND, DGND to GND (pin 1 on mbed). Star grounding and "Star V+ing" should be taken into consideration for noise issues.
Other important connections on the AIC23B:
  • Connect a .1 uF and 10 uF (polarized, + to pin, - to ground) cap in parallel to pin 16, VMID
  • GND and V+ should have at least one filtering cap (eg, .1 uF)
  • Mode and CS should be grounded (not sure about this!)
Also, make sure you connect your analog audio interfaces (that is, headphone jacks, 1/4" jacks, etc!) to their appropriate pin.  I believe you need to decouple them; that is, place a capacitor between them and the pin in question.
At this stage, running Mark B's ported I2S code, my mbed hangs on line 54:
    while ( !I2SDMA0Done || !I2SDMA1Done );
I believe this means that the DMA interrupt never happens.  Not sure, and I'm not sure where to go from here either.  I believe this could be because the AIC23B also needs some SPI or 2-wire circuitry in order to control it (eg, it uses 2x I2S SDA, CLK, and WS connections in addition to a serial interface for controlling it).  Not sure!


7 comments

07 Sep 2010

"I believe this means that the DMA interrupt never happens.  Not sure, and I'm not sure where to go from here either.  I believe this could be because the AIC23B also needs some SPI or 2-wire circuitry in order to control it (eg, it uses 2x I2S SDA, CLK, and WS connections in addition to a serial interface for controlling it).  Not sure!"

 

Yes, you do need an additional SPI interface to configure the AIC23. Once the AIC23 is configured in master mode, it will start clocking in and out samples. In slave mode (AIC23 being the slave), the mbed will have to provide the chip select and clock signals. If your DMA is not transferring anything, either it is configured incorrectly or it is not getting an interrupt because there are no sample transactions coming from the AIC23. In master mode, the AIC23 furiously wiggles the I2S serial pins, so if they aren't wiggling, you will never interrupt.

04 Jan 2011

Hi Colin,

Thanks for your mail!

Ah.., On my mbed, I configured the TLV320AIC23B as MASTER,  mbed as SLAVE. because LPC1768 seems to have some errors on I2S_PCLK. To control AIC23, I use I2C. (AIC23B's pin settings :: 'MODE' pin=0,'CS' pin=0 : addr=0x56)

To drive AIC23 easily, we may use I2S with non-DMA,non-interrupt, but polling.

Did you try to use I2S with polling?

 

Thanks.

 

 

 

 

 

04 Jan 2011

Cool, I think I have configured the AIC23B as Master via

    // 0b0000111 = Digital audio interface format
    // Should be 0b001000010, third bit is master mode, last two bits set I2S
    sendI2C(0x07, 0x082);

sendI2C is my I2C control function.  With pin CS = 0, I would think that the address is 0x34.  In your code, it's defined as

#define AIC23B_ADDRESS  (52)

which is 0x34 in hex.  If I use 0x56 all my I2C messages fail, so I think you meant 0x34!

I have not tried the I2S with polling, I am using the ported Keil code (I think you are using NXP's example code), which doesn't have this as an option.  Is there anywhere I can read up more on this mode?  Also, how did you connect the mbed and AIC23B, physically pin-to-pin?  Thanks very much!

-Colin

04 Jan 2011

Also, what did you use for the AIC23B's clock (XTI pin)?  Did you wire a crystal or did you generate it from the mbed?

-Colin

05 Jan 2011

Hi Colin,

Yes. According to 'DATA MANUAL' of TLV320AIC23B,if CS=0,the address of AIC23 is (0011010). This is 7bits address. So we must give mbed I2C command to AIC23B in 8bits (0011010)<<1 | 0 = 00110100 = 0x34.

Ah... Neither Keil nor NXP's example does not give us any code to control AIC23B. So We must add AIC23B control commands.

You can find I2S example codes (polling/ interrpt / one-shot-DMA) in CMSIS code called 'LPC17xx.cmcis.example' in NXP's website. but other control ...for example, I2C , SDFileSystem, you'll add  in manually...

And your physical connection is correct. OK. you can add the connection of I2C is below...

(mbed)     ->     (AIC23B)

(sda)p9    ->     (SDIN) 23

(scl)p10   ->     (SCLK) 24

 

I connected XTI/MCLK pin 12MHz external oscillator (this is 'USB MODE').

Regards

-Atsushi

 

 

 

05 Jan 2011

OK, great.  I see that you're right about the Keil and NXP code, so I will play with the CMSIS code instead.  I think my I2C implementation and hookup are correct now so hopefully it's just a matter of getting the I2S interaction on the LPC1768 correct.  I am currently generating a 12 Mhz signal with the mbed, hopefully that will work!  Thanks for your help, I will let you know how it goes.

-Colin

05 Jan 2011

Hi Colin,

Thanks for reply. I hope your I2S codec work successfully.

Regards

-Atsushi.

 

You need to log in to post a comment