AnsweredAssumed Answered

Question about I2S block processing on Blackfin platform

Question asked by Quiwi on Aug 25, 2015
Latest reply on Sep 8, 2015 by SachinV

I am using BF533 ezBoard and have tested the example codes named 'Audio codec talkthrough-I2S(C)'. The audio data in this project are processed sample by sample. However, we must process the audio data block by block as we have done on the Sharc21489 floating-point platform.

 

I modified the template codes, but the output wave were not correctly from the oscilloscope, the waves are periodic but not in the sine shape. The main codes are simply attached below

 

#define NUM_SAMPLES 32

volatile int iTxBuffer1[NUM_SAMPLES*4];

volatile int iRxBuffer1[NUM_SAMPLES*4];

int Rx_L0[NUM_SAMPLES];
int Rx_R0[NUM_SAMPLES];
int Rx_L1[NUM_SAMPLES];
int Rx_R1[NUM_SAMPLES];

int Tx_L0[NUM_SAMPLES];
int Tx_R0[NUM_SAMPLES];
int Tx_L1[NUM_SAMPLES];
int Tx_R1[NUM_SAMPLES];

 

void Init_Sport0(void)
{
*pSPORT0_RCR1 = RFSR | RCKFE;
*pSPORT0_RCR2 = SLEN_24 | RXSE | RSFSE;

*pSPORT0_TCR1 = TFSR | TCKFE;
*pSPORT0_TCR2 = SLEN_24 | TXSE | TSFSE;
}

 

void Init_DMA(void)

{

*pDMA1_PERIPHERAL_MAP = 0x1000;

*pDMA1_CONFIG = WNR | WDSIZE_32 | DI_EN | FLOW_1;

*pDMA1_START_ADDR = (void *)iRxBuffer1;

*pDMA1_X_COUNT = NUM_SAMPLES*4;

*pDMA1_X_MODIFY = 4;

 

*pDMA2_PERIPHERAL_MAP = 0x2000;

*pDMA2_CONFIG = WDSIZE_32 | FLOW_1;

*pDMA2_START_ADDR = (void *)iTxBuffer1;

*pDMA2_X_COUNT = NUM_SAMPLES*4;

*pDMA2_X_MODIFY = 4;

}

 

EX_INTERRUPT_HANDLER(Sport0_RX_ISR)
{
int i;
*pDMA1_IRQ_STATUS = 0x0001;


for(i=0;i<NUM_SAMPLES;i++)
{
  Rx_L0[i] = iRxBuffer1[4*i];
  Rx_R0[i] = iRxBuffer1[4*i+2];
  Rx_L1[i] = iRxBuffer1[4*i+1];
  Rx_R1[i] = iRxBuffer1[4*i+3];
}
Process_Data();   

for(i=0;i<NUM_SAMPLES;i++)
{
  iTxBuffer1[4*i] = Tx_L0[i];
  iTxBuffer1[4*i+2] = Tx_R0[i];
  iTxBuffer1[4*i+1] = Tx_L1[i];
  iTxBuffer1[4*i+3] = Tx_R1[i]; 
}
}

 

void Process_Data(void)
{
int i;
for(i=0;i<NUM_SAMPLES;i++)
{
  Tx_L0[i] = Rx_L0[i];
  Tx_R0[i] = Rx_R0[i];
  Tx_L1[i] = Rx_L1[i];
  Tx_R1[i] = Rx_R1[i];
}

}

 

I have some experience on the Sharc platform, the AD21489 can process I2S audio data by block, and the DMA works in Piongpong mode. I am wondering could BF533 also work in the similar way (Pingpong chained mode)?

 

And could anyone give me some advices on how to configure the SPORT or the DMA on Blackfin processors to make I2S audio process work correctly in the block-by-block way?

 

Many thanks!

Outcomes