I'm attempting to bring up DMA3 channel 0, to pull mono data from I2S1 and place it into memory. Eventually ping-pong transfer will be used, the DMA will be configured to auto-reload, interrupts will be enabled, etc. but I'm bringing things up step by step first.
DMA3 channel 0 is set with I2S1 RX as the synchronization source. DMA3CESR1 is set to 0x02, which should set the DMA3 channel 0 synchronization source to I2S1 receive; this is missing in the C5535 documentation, but previous posts on this forum seem to indicate that what I'm doing is correct.
I'm finding that as soon as DMA is enabled, the entire DMA transfer happens without synchronization - all 192 entries in the i2s_dmabuffer[] are overwritten with the values in I2S1_I2SRXLT0/1. I2S isn't enabled at this point, and neither are the physical signals which feed the I2S1 port. Even if I enable I2S first and DMA second, the same behavior still happens - no physical signals are present, but the entire DMA transfer still occurs.
I've double-checked everything I can think of - pin configuration is correctly set to enable I2S1, all register writes have been double-checked with the emulator, etc.
Any thoughts? Code is below.
// RX buffer
uint16_t i2s_dmabuffer[i];
// I2S1 config
*pPCGCR1 &= ~(1<<I2S1CG); // enable I2S1 clock
*pI2S1_I2SSCTRL = (0<<ENABLE)|(1<<MONO)|(0<<FSPOL)|(1<<CLKPOL)|(0<<DATADLY)|(1<<PACK)|(0<<SIGN_EXT)|(2<<WDLNGTH)|(0<<MODE)|(1<<FRMT);
*pI2S1_I2SINTMASK = 0;
// DMA3 config
*pPCGCR2 &= ~(1<<DMA3CG);
*pDMA3_DMACH0TCR2 = (0<<EN)|(0<<INTEN)|(0<<AUTORLD)|(0<<DSTAMODE)|(2<<SRCAMODE)|(0<<BURSTMODE)|(0<<SYNCMODE)|(0<<PING_PONG_EN);
*pDMAIER &= ~(0xF000);
*pDMAIFR = 0xF000;
*pDMA3_DMACH0TCR1 = 384;
*pDMA3_DMACH0SSAU = 0;
*pDMA3_DMACH0SSAL = 0x2928; // I2S1 RXLT0
*pDMA3_DMACH0DSAU = (uint16_t) (((uint32_t) &i2s_dmabuffer[0] >> 15) & 0xFFFF) + 1;
*pDMA3_DMACH0DSAL = (uint16_t) (((uint32_t) &i2s_dmabuffer[0] << 1) & 0xFFFF);
*pDMA3CESR1 = (2<<CH0EVT);
// enable DMA
*pDMA3_DMACH0TCR2 |= (uint16_t) (1<<EN);
// enable I2S
*pI2S1_I2SSCTRL |= (uint16_t) (1<<ENABLE);
Thanks!