This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

McASP and buffered data

Hello,

i have a problem with the McASP unit and buffered data. I used a HWI for getting the input data from the McASP unit. Input and output serializer has the same clock.

XBUF11 = Transmit channel and XBUF12 = Receive channel

 

When i used a single int var it works:

int data;

void McASPInt(void) {
  MCASP->XBUF11  = data;
  data           = MCASP->XBUF12;
}

The input is echoed with a small delay.

 

If i exchange this to an int array for getting greater delays, it fails:

#define BUFFER_SIZE 48

int InBuffer[BUFFER_SIZE];
int BufferIndex;

void McASPInt(void) {
  int RingIndex = (BufferIndex%BUFFER_SIZE);

  MCASP->XBUF11       = InBuffer[RingIndex];
  InBuffer[RingIndex] = MCASP->XBUF12;

  BufferIndex++;
}


I set a breakpoint at the output and check the InBuffer and the RingIndex. Everything is OK, but nothing is output.

I wondered why i don't get an output, although the same routine worked correctly with a single int.

Have anybody an idea, what could be the reason?

 

 

  • My first thought is that you need to swap the order of the McASP write and read. Since you are trying to echo, it should be written to read the input data first, then write that to the output. The single int var method works with a small delay because it is saving the previous input and writing that when the next interrupt occurs. With the larger buffer, there is a much longer delay between input data and that same data being output.

    That would not completely explain "nothing is output".

    Reduce BUFFER_SIZE to 1 and both routines should be the same. See if it works then.

  • Dear Fjs,

     

    works your application without dMAX? What DSP do you use? I tried the same - a simple loop back of audio data from XBUF0 to XBUF1, but there comes no audio signal out of the codec, if I don'i use dMAX. Could you send me you McASP initial?

     

    Thanks and best regards,

    Michael.