I have got following code snippet for initialising I2S with DMA from http://www.cypress.com/file/134661/download page no 196.
/* Configure the I2S interface. */
CyU3PMemSet ((uint8_t *)&i2sCfg, 0, sizeof (i2sCfg));
i2sCfg.isMono = CyFalse;
i2sCfg.isLsbFirst = CyFalse;
i2sCfg.isDma = CyTrue;
i2sCfg.padMode = CY_U3P_I2S_PAD_MODE_NORMAL;
i2sCfg.sampleRate = CY_U3P_I2S_SAMPLE_RATE_44_1KHz;
i2sCfg.sampleWidth = CY_U3P_I2S_WIDTH_16_BIT;
status = CyU3PI2sSetConfig (&i2sCfg, NULL);
It is mentioned that if the pad mode is NORMAL, then in the 32 bit sample data, its LSB shall be padded with zeroes.
In the above example code, it configures the I2S as PAD MODE NORMAL and sample width is 16 bit. The DMA it creates is auto DMA (Page no 196, sec 220.127.116.11). If its auto DMA mode, how does the zeroes get padded to the sample data?
2) Can buffer underrun occur for Auto DMA? If it occurs, can you please give me example code which handles the buffer underrun for I2S Auto DMA?
1) It is expected to pad zeros. But this feature has not been tested internally. Please go ahead with the implementation and let us know, if you face any issue.
2) If it occurs, please call, CyU3PDmaChannelReset, and flush and reset the corresonding enf point.
- Madhu Sudhan