I2S hardware and pinout

18 Nov 2009

I just got a question about I2S and mbed.

You may not yet know it, but the mbed includes hardware support for I2S, a communications protocol for digital audio. The common case would be to connect a high-quality audio Digital-to-Analog Converter (DAC) and/or Analog-to-Digital Converter (ADC) to the mbed.

There is no library yet as we haven't ever looked at anything that could talk to it, but seems like it has potential for some interesting applications.

The specific question was about where it pins out, so here you go:

 p5 = P0_9 - I2STX_SDA
 p6 = P0_8 - I2STX_WS
 p7 = P0_7 - I2STX_CLK 
 p8 = P0_6 - I2SRX_SDA 
 p15 = P0_23 - (I2SRX_CLK) 
 p16 = P0_24 - (I2SRX_WS)
 p17 = P0_25 - (I2SRX_SDA)
 p29 = P0_5 - I2SRX_WS 
 p30 = P0_4 - I2SRX_CLK 

Those listed in ()'s are alternate pinout locations.

Lets see if any projects can make use of this peripheral!


19 Nov 2009 . Edited: 19 Nov 2009

Using a ADC with I2S seems quite useless due to all the ADC's available on the chip. Unless you are able to do more analog line inputs with a single ADC. But since you'll only have a 3-wire I2S, it will be (a bit more) difficult to do multiple channels, since you'll have to introduce a 3rd clock.

A project with a DAC could be one with a stereo, or more, output. One of the ideas that I've been thinking about it an alarmclock using an internet stream from a radiostation. However, the onboard memory might be a project killer. Don't know for sure, so I'll have to dig into that deeper.

Specs at this moment would be: Power over Ethernet, stereo DAC using a MAX5556 and a display (which is undefined at the moment)

A second project was an analog intercom, but since they won't like it when I hack the current intercom, I'll leave that for what it is.

Update: I took a closer look, and the LPC1768 has a TX_MCLK and a RX_MCLK pin, however it's not connected (pin 82 and 85 in the schematics).

15 Jan 2010

I am interested in using the I2S blocks on the mbed, how would I get started? (I presume I'd have to create a library first...)

15 Jan 2010

Mark, do you plan to receive or transmit data? What is your device and do you have a datasheet?

18 Jan 2010

I plan on doing both, so I can have 2 input channels and 2 output channels. For ADC, I'm using PCM1803A which I currently have hooked up and working with an FPGA but this is a bit overkill and the mbed would be a much better fit.

The PCM1803A datasheet can be found here:


The LPC1768 datasheet can be found here:


I've not had a chance to take a look at this in detail yet, I'm not expecting someone else to do all the work, I want to avoid reinventing the wheel though.


18 Jan 2010

It seems there is only one input and one output on the chip, however, I2S can transmit stereo on one line (Left and right data is distinguished by the WS(Word Select) signal).

You should start by reading the User Manual, as datasheet contains little more than physical and electrical specs. I2S is described in Chapter 20. For programming examples, see Keil sample code bundle or CMSIS Driver Library.

18 Jan 2010

Yeah, I'm hoping the mbed can transmit 1 stereo pair at the same time as receive 1 stereo pair for a total of 4 channels of audio. Is this assumption wrong?

18 Jan 2010

Yes, that should work.

20 Jan 2010

I've imported the I2S Keil sample code and got something that compiles without errors. Unfortunately the sample code isn't using a setup I want. (I want a 32-bit slave I2S Receive.) So I'm going to have to think about what settings to change, etc. Its been a while since I've used text-based programming, as I've been using g-code for the last year (LabVIEW) so I'll have to think about this deeply!

If anyone else with time on their hands wants to take a look at this, you can grab my code here: