I2S Library

The mbed has a rather powerful I2S interface, however there has yet been a library written to take advantage of it. I'm going to make an attempt here.

From the LPC1768 datasheet:

The I2S interface is configured using the following registers:

1. Power: In the PCONP register set bit PCI2S.
2. Clock: In PCLKSEL1 select PCLK_I2S.
3. Pins: Select I2S pins and their modes in PINSEL0 to PINSEL4 and PINMODE0 to PINMODE4.
4. Interrupts are enabled in the NVIC using the appropriate Interrupt Set Enable register.
5. DMA: The I2S interface supports two DMA requests.

The first step in an I2S library will be to turn on the peripheral, and then set up the clocks.

LPC_SC->PCONP |= (1 << 27); // turn on I2S

LPC_SC->PCLKSEL1 &= (00 << 22); // clear I2S P_CLK
LPC_SC->PCLKSEL1 |= (01 << 22); // set to CCLK/1 = PCLK

These settings are true for both the receive and transmit portions of the I2S peripheral.

 

I've now released the first iteration of my library: I2S I hope to get it included in the official mbed.h release at some point.


0 comments

You need to log in to post a comment