On the NGX 4330 Xplorer board, the I2S DMA sample demonstrates nicely using the peripheral to peripheral DMA transfer (GPDMA_TRANSFERTYPE_P2P_CONTROLLER_SrcPERIPHERAL) from the RX to TX paths on the I2S0 peripheral:
uint8_t continue_Flag = 1, bufferUART = 0xFF;
Chip_I2S_DMA_TxCmd(CODEC_I2S_BUS, I2S_DMA_REQUEST_CHANNEL_1, ENABLE, 4);
Chip_I2S_DMA_RxCmd(CODEC_I2S_BUS, I2S_DMA_REQUEST_CHANNEL_2, ENABLE, 4);
/* Initialize GPDMA controller */
Chip_GPDMA_Init(LPC_GPDMA);
/* Setting GPDMA interrupt */
NVIC_DisableIRQ(DMA_IRQn);
NVIC_SetPriority(DMA_IRQn, ((0x01 << 3) | 0x01));
NVIC_EnableIRQ(DMA_IRQn);dmaChannelNum_I2S_Rx = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, I2S_DMA_RX_CHAN);
Chip_GPDMA_Transfer(LPC_GPDMA, dmaChannelNum_I2S_Rx,
I2S_DMA_RX_CHAN,
I2S_DMA_TX_CHAN,
GPDMA_TRANSFERTYPE_P2P_CONTROLLER_SrcPERIPHERAL,
1);
However, in the application I am targeting, I want to connect two different I2S source devices onto the pins of I2S0 and use the pin mux to switch between the two sources. That part is simple enough. I2S1 is used as the transmitter to an I2S amplifier. BEFORE spinning a board I want to determined if it is possible to use the peripheral to peripheral DMA transfer between I2S1 receiver to trigger transfer to the I2S0 transmitter. I'm trying to avoid buffering and transmitting from a buffer if possible.
I'm assuming the DMA example will work by changing the I2S base peripheral in the Chip_I2S_DMA_RxCmd DMA setup but I it is difficult to test with the NGX Xplorer board.
Does anyone know if this is possible? If so, do you know what the Chip_I2S_DMA_TxCmd( I2S1..) , Chip_I2S_DMA_RxCmd( I2S0..) and Chip_GPDMA_Transfer setup is for triggering between the two I2S peripherals for this scenario?
Hi Nathan,
It is worth trying, P2P DMA transfer spanning different I2S peripheral is supported by DMA, however there could be synchronization issues if clock source settings for the 2 I2S peripherals are different, the 8 word FIFOs in I2S help lower the risk.
To try it out, just modify the macros to corresponding I2S peripheral address and DMA channel number.
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer