LPC4088 as I2S Transmitter Slave 4-wire with SGTL5000

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC4088 as I2S Transmitter Slave 4-wire with SGTL5000

116 Views
Contributor I

Hello I cant transmit as Slave with 4-wire using I2S.

Electrical Setup using LPCQuickStartBoard rev B:

SGTL5000_DOUT to LPC4357_RX_SDA p17 (P0.25)

SGTL5000_DIN to LPC4357_TX_SDA p11 (P0.9)

SGTL5000_SCK to LPC4357_RX_SCK p15 (P0.23)

SGTL5000_WS to LPC4357_RX_WS p16 (P0.16)

SGTL is in Master Mode:

SCK is 512 Khz (scope tested)

WS is 8kHz (scope tested)

Fs is kHz (programmed into SGTL5000)

SGTL is using PLL with a 24 MHz oscilator

SGTL is transmitting noise because i have mic multiplexed to I2S out

I need to Play sound from LPC to SGTL, i cant seems to send data.

From UM10562 Section 23 the setups i need for this to work are:

Reception Fig 136 Typicalreceiver Slave mode using 3 pins as Input

    I2S_RX_CLK

    I2S_RX_SDA

    I2S_RX_WS

I2SDAI[5]=1

I2SRXMODE[3:0]=0000

IOCON register is also correctly asigned to function.

FOR NOW NO DMA IS INTENTED TO BE USED

Transmission Fig 132 4-wire transmitter slave mode sharing the receiver bit clock and WS, uses one Pin as Output:

    I2S_TX_SDA

    Clock is derived from RX bit clock
    WS is derived from RX_WS

I2SDAO[5]=1

I2STXMODE[3:0]=0100

IOCON register is also correctly asigned to function.

FOR NOW NO DMA IS INTENTED TO BE USED

When i run the program in debug mode and send a byte to the TXFIFO i get  the interrupt but no byte is sent to the pin.

Using direct write to the FIFO: LPC_I2S->TXFIFO = 0x55; produces no output even when the ISR ins triggered and also the TX Interrupt fifo level is set to 1

Here is my code using a Library from mbed 

I2S* i2s_tx = new I2S( I2S_TRANSMIT, p11, true );
i2s_tx->frequency(8000);
i2s_tx->wordsize(16);
i2s_tx->stereomono(I2S_STEREO);
i2s_tx->masterslave(I2S_SLAVE);
i2s_tx->set_interrupt_fifo_level(1);
int yes = i2s_tx->setup_ok();
i2s_tx->attach(&SGTL5000::I2S_TxData);//callback to the ISR interrupt call
i2s_tx->start();
int datotest[]={5};
i2s_tx->write(datotest, 1); //send one data

I suspect that there is some missing config in the 4-wire mode. When i check the registers using the path from UM10562 Fig.139 "I2S clocking and pin connections" the values seems correct.

My question is Do i need to configure an RX object before using the TX 4-wire mode? or it can be independant?

The data is not showing in TX SDA

Regards

Labels (1)
0 Kudos
2 Replies

12 Views
Contributor I

Well, im Just answering this by myself because i want to help others.

In efect you cant use 4-wire TX as a Slave if yoou dont keep the i2s RX slave Instance working. I did several tests and this is how it works.
For mbed I2S lirbrary you have to:

Create an I2S Receiver object and configure it,

I2S* i2s_rx = new I2S( I2S_RECEIVE, p17, p16, p15 );///this can be static if you need to and, belong to a class

i2s_rx.frequency(8000);
i2s_rx.wordsize(16);
i2s_rx.stereomono(I2S_MONO);
i2s_rx.masterslave(I2S_SLAVE);
i2s_rx.attach(&SGTL5000::I2S_RxData);
i2s_rx.start();
//int rxData = i2s_rx.read();//for testing
i2s_rx.stop();//this function wont deactivate the IRQ for TX/RXFIFO this must be a BUG

Only after this element you can create an I2S transmitter element as follows:

I2S*  i2s_tx(I2S_TRANSMIT, p11, true);//this can be static if you need to, and belong to a class

i2s_tx.frequency(8000);
i2s_tx.wordsize(16);
i2s_tx.stereomono(I2S_STEREO);
i2s_tx.masterslave(I2S_SLAVE);
int yes = i2s_tx.setup_ok();
i2s_tx.attach(&SGTL5000::I2S_TxData);
i2s_tx.start();
//char datotest[]={5};
//i2s_tx.write(datotest, 1);
i2s_tx.stop();//this function wont deactivate the IRQ for TX/RXFIFO this must be a BUG

Regards, in contrary case you can use 4wire RX but before you need 3 wire master TX

0 Kudos

12 Views
NXP TechSupport
NXP TechSupport

Hi Alejandro,

 

Thanks a lot for sharing your solution with the community!

 

Best regards,

Felipe

0 Kudos