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.

ATAFS Write while Processing Audio

Hi everyone,

I am aiming to use the EZDSP5535 to process audio and write the data to the SD card. Right now as a test, I am performing an audio loopback operation (16bit @ 44.1KHz) while 1024 word-samples of data are written on to the SD card each time through TI's ATAFS. However it seems like the audio write time is taking a long time, thus loopback is missing samples? (very serious as it's audible). These operations are all done in a task in DSP/BIOS as shown below. Any suggestions/ideas are greatly appreciated!

task {     
     ata_error = ATA_fopen(pAtaFile, "rec", "wav");     
     if(ata_error != ATA_ERROR_NONE)
          printf("ATA_fopen Failed %d\n", ata_error);
     else
          printf("\nFile Creation/Open on SD card is Successful\n");

     // issue in and out buffers before reclaim
     for(i=0; i<NUM_OUT_BUFS; i++) {
          SIO_issue(hStreamIn, &audBufsIn[i][0], WORDS_PER_OUT_BUF, NULL);
	  SIO_issue(hStreamOut, &audBufsOut[i][0], WORDS_PER_OUT_BUF, NULL);
     }

     // simple way to set audio recording time
     for(btr=0;btr<WORDS_PER_OUT_BUF*5;btr++) {

          //get an empty audio buffer, blocking until buffer a/v
          SIO_reclaim(hStreamIn, (void**)&inBuf, NULL);
	  SIO_reclaim(hStreamOut, (void**)&outBuf, NULL);

          // copy audio input data to output stream
          for (i = 0; i < WORDS_PER_OUT_BUF; i++) {
               outBuf[i] = inBuf[i];
          }

	  SIO_issue(hStreamOut, outBuf, WORDS_PER_OUT_BUF, NULL);
	  SIO_issue(hStreamIn, inBuf, WORDS_PER_OUT_BUF, NULL);

          // byte swap sample, as MMC_setEndianMode() to big endian doesn't seem to work
          for (i = 0; i < WORDS_PER_OUT_BUF; i++) {
               outBuf[i] = (outBuf[i]<<8) | ((outBuf[i]>>8)&0x00FF);
          }

	  ata_error = ATA_write(pAtaFile, outBuf, WORDS_PER_OUT_BUF);
	  if(ata_error != ATA_ERROR_NONE)
               printf("ATA_write Failed %d \n", ata_error);
     }
     ata_error = ATA_close(pAtaFile);
     if(ata_error)
          printf("ATA_close Failed\n");
}
  • As an update, I have tried splitting the above code into two tasks:

    1. Higher priority, performing loopback function
    2. Lower priority, performing the write function

    There appears to be no improvements, however. Is there a way to enable RTA so I can see what's going on with each thread, CPU execution graph, etc logs?

  • Hello TI Support,

    It seems that the context switching between tasks is causing audio pops as well (I have commented out ATA_write). Should this happen at all?? Have I overestimated the C55xx DSPs to perform such simple task of processing audio while writing to SD?

  • asd asd said:

    Hello TI Support,

    It seems that the context switching between tasks is causing audio pops as well (I have commented out ATA_write). Should this happen at all?? Have I overestimated the C55xx DSPs to perform such simple task of processing audio while writing to SD?

     
    Hello asd asd
     
    I am trying to do the very same thing. Firstly did you ever find a solution? And did you try to use dma and ping/pong buffers for transfers?
  • Hello,

    I am working with ezdsp5535 kit on recording 16bit @ 44.1KHz stereo audio in raw format on sdcard without success. Playback is working without problems but I am having trouble getting real time recording to work.

    Did you ever find a solution for this problem?

    Thanks in advance for your replay.

    Best regards,

    Predrag M.