AnsweredAssumed Answered

ADSP21489 I2S DMA configration

Question asked by cuckoo on Apr 18, 2016
Latest reply on Oct 7, 2016 by Jithul_Janardhanan

     I designed a multichannel audio processing system using ADSP-21489, which have four I2S channels input and one I2S channel output.During debug, I encounter a problem: the system can get audio data by DMA mode, but can't transmit the data to DAC. I watch the signal of DAI_PIN01, found that the signal always keep low status when the system runing. The SPORT part code is following, and the whole project code in accessory. Please help me to find what's the really cause.Thank you very much.

 

 

asm("#include <def21489.h>");
#include <stdfix.h>
#include "audio_process.h"

fract rx_I2S_Buf[INPUT_I2S_NUM][num_samples_ISR];
float tx_I2S_Buf[OUTPUT_I2S_NUM][num_samples_ISR];

int receivetcb[INPUT_I2S_NUM][4];
int transmttcb[OUTPUT_I2S_NUM][4];

 

void enable_SPORT()
{

/* Clear the Mutlichannel control registers */
*pSPMCTL0 = 0;
*pSPMCTL1 = 0;
*pSPMCTL2 = 0;
*pSPMCTL3 = 0;

*pSPMCTL4 = 0;
*pSPMCTL5 = 0;
*pSPMCTL6 = 0;
*pSPMCTL7 = 0;

/* Clear the SPORT control registers */
    *pSPCTL0 = 0;
    *pSPCTL1 = 0;
*pSPCTL2 = 0;
    *pSPCTL3 = 0;

*pSPCTL4 = 0;
    *pSPCTL5 = 0;
*pSPCTL6 = 0;
    *pSPCTL7 = 0;

    /* External clock and frame syncs generated by Audio Codec */
    *pDIV0 = 0x00000000;
    *pDIV1 = 0x00000000;
*pDIV2 = 0x00000000;
    *pDIV3 = 0x00000000;

*pDIV4 = 0x00000000;
    *pDIV5 = 0x00000000;
*pDIV6 = 0x00000000;
    *pDIV7 = 0x00000000;


int i2s_id;
for(i2s_id = INPUT_I2S_NUM - 1; i2s_id >= 0; i2s_id--)
{
  receivetcb[i2s_id][0] = ((int) receivetcb[i2s_id] + 3) & 0x7FFFF | (1<<19);
  receivetcb[i2s_id][1] = num_samples_ISR;
  receivetcb[i2s_id][2] = 1;   // I/O step size
  receivetcb[i2s_id][3] = (int)rx_I2S_Buf[i2s_id];
}

for(i2s_id = OUTPUT_I2S_NUM - 1; i2s_id >= 0; i2s_id--)
{
  transmttcb[i2s_id][0] = ((int) transmttcb[i2s_id] + 3) & 0x7FFFF | (1<<19);
  transmttcb[i2s_id][1] = num_samples_ISR;
  transmttcb[i2s_id][2] = 1;   // I/O step size
  transmttcb[i2s_id][3] = (int)tx_I2S_Buf[i2s_id];
}

*pCPSP0A = ((int) receivetcb[0] + 3) & 0x7FFFF | (1<<19);
*pCPSP0B = ((int) receivetcb[1] + 3) & 0x7FFFF | (1<<19);


*pCPSP4A = ((int) transmttcb[0] + 3) & 0x7FFFF | (1<<19);
*pCPSP4B = ((int) transmttcb[1] + 3) & 0x7FFFF | (1<<19);



 
*pSPCTL0 = ( 
  SPEN_A |    /* Enable Channel A */
  SPEN_B | /* Enable Channel B */
  L_FIRST|    /* I2S sends left first */
  SLEN32 |    /* word length */
  OPMODE |    /* Enable I2S Mode*/
  SDEN_A |    /* Enable Channel A DMA */
  SDEN_B | /* Enable Channel B DMA */
  SCHEN_A| /* Enable Channel A DMA Chaining */
  SCHEN_B  /* Enable Channel B DMA Chaining */
  );  

*pSPCTL4 = (SPTRAN|SPEN_A|SPEN_B|L_FIRST|SLEN32|OPMODE|SDEN_A|SDEN_B|SCHEN_A|SCHEN_B);


}

 

 

void ReceiveADC(void)
{
int i, j;
for(i = 0; i < INPUT_I2S_NUM; i++)
{
  for(j = 0; j < block_size; j++)
  {
   L_AES_In[i][j] = (float)rx_I2S_Buf[i][2*j];
   R_AES_In[i][j] = (float)rx_I2S_Buf[i][2*j + 1];
  }
}

}

 

void TransmitDAC(float* L_Buf, float* R_Buf)
{

int i;
for(i = 0; i < block_size; i++)
{
  tx_I2S_Buf[0][2*i]     = (fract)L_Buf[i];
  tx_I2S_Buf[0][2*i + 1] = (fract)R_Buf[i];
 
}  

}

Attachments

Outcomes