== I2S configuration with mbed in Slave mode ==

09 Mar 2012

Hello,

I have an application, where I want to receive data from an external ADC. In this configuration, I will use the mbed in "Slave mode" and I will you use the rx channel to get the data.

The LPC17xx user manual shows this configuration in Chapter 20 "Fig. 110. Typical receiver slave mode".

So I will receive the I2SRX_CLK from the ADC. In my case it is 6,144Mbit/s for a frame of 2*32bit with a sampling rate of 96kHz.

My question:

Do I have to setup the PCLKSEL1 register ? The manual requires it for the basic setup.

I think not, since the bit clock will be provided by the ADC, which is setup as Master.

Thanks for any advice.

Michael

Code extract:


LPC_SC->PCONP |= (1 << 27);	//power up I2S

// ????? LPC_SC->PCLKSEL1  |= (3 << 22); // as an example CCLK:8 = 96MHz:8=12MHz;

LPC_SC->PINSEL0 |= (1 << 14); // I2SRX_CLK  ; P0[23] is Mbed Pin 15
LPC_SC->PINSEL0 |= (1 << 16); // I2SRX_WS   ; P0[24] is Mbed Pin 16
LPC_SC->PINSEL0 |= (1 << 18); // I2SRX_SDA  ; P0[25] is Mbed Pin 17

LPC_SC->I2SRXMODE = 0x0; // Typical Receiver Slave Mode ,page 486 LPC17xx handbook

LPC_SC->I2SDAI |= (3 << 0); // wordwidth 32 bit data
LPC_SC->I2SDAI |= (0 << 2);  // Set Stereo
LPC_SC->I2SDAI |= (1 << 5);  // set Slave Mode

LPC_SC->I2SRXBITRATE = 0x1F; // is 63, because RX_MCLK(6,144Mbit/s) : (63+1) = 96kHz 

LPC_SC->I2SIRQ |= (1 << 0);  // Enable I2S receive interrupt