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.

TMS320C5515: C5000 Connected Audio Framework issue

Genius 5840 points
Part Number: TMS320C5515
Other Parts Discussed in Thread: SYSBIOS

Hello.

I currently have a project of C5000 Connected Audio Framework running on TMDXEVMC 5515, but have the following problems and can you tell me the solution?

1.Download to TMDXEVMC5515 and run the project "CSL_USB_IsoFullSpeedExample_Out"

2.Connect TMDXEVMC5515 and PC, and identify as USB product in PC

3.Input audio to EVM's STEREO IN 1 and start recording on the PC

4.Stop recording on the PC while audio playing back to the EVM

5.Make the sound of EVM's STEREO IN 1 silence 

6.When recording is started again on the PC, at the beginning, a few packets of residual sound when the previous recording is stopped playback ←It's the probrem!

I would like to clear the remaining sounds when the previous recording stops by the time I start recording again.

Running FLUSH FIFO with the following code at line 560 of app_usbac.c did not fix the problem.

volatile Uint16 tmpVal;
tmpVal = usbRegisters->EPCSR[0].PERI_TXCSR;
tmpVal |= CSL_USB_PERI_TXCSR_FLUSHFIFO_MASK;
tmpVal &= ~(0x3);
usbRegisters->EPCSR[0].PERI_TXCSR = tmpVal;
usbRegisters->EPCSR[0].PERI_TXCSR = tmpVal;

Is there any good solution?

Regards,

U-SK

  • Hi U-SK,

    The issue needs to be deeply investigated but could you share the download link to check whether you are using the last SW release?

    BR
    Tsvetolin Shulev
  • I have not reproduced this issue or studied the software.
    But maybe you could experiment with resetting the I2S peripheral to clear the data from there also.
    I would check the FLUSH FIFO function also to make sure it clears all possible I2S buffers. Are Ping Pong buffers being used?
    Regards,
    Mark
  • Hi BR,

    Thank you for your reply.
    It 's latest version v02.00.02.04 .
    If there are a good solution, I would be happy if you tell me.

    Regards,
    U-SK
  • Hi Mark, 

    Thank you for your reply.

    >Are Ping Pong buffers being used?

    I should be using it.

    I only modified app_usbac.c for imported projects.
    I think that the project that I'm evaluating is supposed to be the flow of data as below, is it right?

    Figure:C:\c55_lp\c55_caf_02.00.02.04\doc\connected-audio-documentation.pdf, page.12

    Because we are currently performing the recording operation, according to c55_caf_release_notes.txt, using ASRC requires the definition of ENABLE_REC_ASRC, but it seems that it is not defined by default.

    Can it be solved by clearing the ping-pong buffer or Codec Input Buffer?
    If so, would you tell me the procedure?

    Regards,

    U-SK

  • Hi Mark,

    Do you have any updates about my question?

    Regards,

    U-SK
  • Hi U-SK,

    I'm trying to get support from the software team for this issue.

    Regards,
    Mark
  • Hi Mark,

    Thank you for your contact.

    I look forward to your investigating result.

    Regards,

    U-SK

  • Hi Mark,

    I apologize for keep asking.
    Do you have any updates about my question?

    Regards,

    U-SK
  • Hi U-SK,

    I worked on C55x CAF a while back and will try to assist in resolving this problem.

    The diagram you've shared for the record data flow is correct. By default, CAF is compiled for asynchronous synchronization in the record path, meaning any rate matching (e.g. digital resampling using ASRC) are performed on the PC. I don't think adding the ASRC into the record path will resolve the issue.

    The Record I2S ping/pong buffers are defined in i2c_sample.c:

    Uint16 ping_pong_i2sRxLeftBuf[2*I2S_RXBUFF_SZ]; /* 2x for ping/pong */
    Uint16 ping_pong_i2sRxRightBuf[2*I2S_RXBUFF_SZ]; /* 2x for ping/pong */

    Greping the code for these buffers:

    $ grep -r -n --regexp="ping_pong_i2sRxLeftBuf" --include "*.c"
    src/app_audio_alg.c:55: ptrRxLeft = &ping_pong_i2sRxLeftBuf[0];
    src/csl_usb_iso_fullspeed_example.c:251: i2sInitPrms.pingPongI2sRxLeftBuf = (Int16 *)ping_pong_i2sRxLeftBuf;
    src/csl_usb_iso_fullspeed_example.c:254: i2sInitPrms.pingPongI2sRxLeftBuf = (Int16 *)ping_pong_i2sRxLeftBuf;
    src/i2s_sample.c:62:#pragma DATA_ALIGN(ping_pong_i2sRxLeftBuf, 2);
    src/i2s_sample.c:63:Uint16 ping_pong_i2sRxLeftBuf[2*I2S_RXBUFF_SZ]; /* 2x for ping/pong */

    From this, I observe there isn't any place in the code these buffers are cleared.

    The SYSBIOS task for recording is named RecAudioAlgTsk(), and is defined in app_audio_alg.c. Looking through the code for this function, I observe:

    /* Store data in circular buffer */
    if (h_usb_int_tcount > 1) /* wait for IN tokens from Host */

    The variable h_usb_int_tcount is the number of USB IN tokens received since recording was initiated.

    Greping the code for this variable:

    $ grep -r -n --regexp="h_usb_int_tcount" --include "*.c"
    src/app_audio_alg.c:110: if (h_usb_int_tcount > 1) /* wait for IN tokens from Host */
    src/app_usb.c:37:Uint16 h_usb_int_tcount = 0;
    src/app_usb.c:250: if (h_usb_int_tcount < 2)
    src/app_usb.c:252: h_usb_int_tcount++;
    src/app_usbac.c:607: h_usb_int_tcount = 0;

    Looking at Line 607 in app_usbac.c, I see h_usb_int_tcount is reset when recording is stopped. This occurs in the function appStopRecordAudio().
    Is seems like this would be a good place to clear the Rx ping/pong buffers. This way they'll be cleared the next time recording is initiated.

    Please let me know if this makes sense, and if it helps with the residual record audio you're observing.

    Regards, Frank

  • Hi Frank,

    Thank you for your reply.

    I understand that I2C Ping Pong Buffer should be cleared to resolve issue.

    I should add only reset_codec_output_buffer() in appStopRecordAudio() Function, right?

    Do you need FLUSHFIFO process I added , too?

    Regards,

    U-SK

  • Hi Frank,

    I added eset_codec_output_buffer() in appStopRecordAudio() Function,
    but problem is not resolved.

    Is there something wrong with my understanding?
    Do you have any updates about my question?

    Regards,

    U-SK
  • U-SK,

    I noticed a previous thread that had a similar question on FLUSHFIFO.

    e2e.ti.com/.../615996

    If there are any data packets in the FIFO, indicated by the FIFONOTEMPTY bit (bit 1 of

    PERI_TXCSR) being set, they should be flushed by setting the FLUSHFIFO bit (bit 3 of PERI_TXCSR).

    Are you able to extract this information to see if indeed there are packets in the FIFO?

    Lali

  • Hi Lail,

    Thank you for your reply.
    I already confirmed the operation with reference to the thread you mentioned.
    I described FLUSH FIFO as originally posted and confirmed that FIFONOTEMPTY is 0 by that processing.

    Are there other possible causes?

    Could you please confirm the following I posted before?

    >I should add only reset_codec_output_buffer() in appStopRecordAudio() Function, right?

    >Do you need FLUSHFIFO process I added , too?

    Regards,

    U-SK
  • Hi,

    Do you have any updates about my question?

    Regards,
    U-SK
  • Hi,

    I apologize for keep asking...
    Do you have any updates about my question?

    Regards,
    U-SK
  • U-SK,

    I checking on this internally.

    Lali
  • Hi U-SK,

    You may want do the

        // reset codec input circular buffer
        memset(codec_input_buffer, 0, CODEC_INPUT_BUFFER_SIZE);

    in appStopRecordAudio().

    It seems the leftover of the previous recording in the codec_input_buffer was used for next recording.

    The recording has to wait for a few frames (50% of the codec_input_buffer size) to start in order to avoid the racing condition.

    Best regards,

    Ming

  • BTW, since there are a few packets got repeated, it is not the USB flush issue. The USB flush issue should be no more than two packets repeated.

    Ming
  • Hi Ming,

    Thank you for your reply.
    I will try to reset codec input buffer.

    >The recording has to wait for a few frames (50% of the codec_input_buffer size) to start in order to avoid the racing condition.

    ・Does that mean we can not solve by only inserting the code below?

    // reset codec input circular buffer
    memset(codec_input_buffer, 0, CODEC_INPUT_BUFFER_SIZE);

     in appStopRecordAudio().

    ・Could you tell me how to wait for a few frames?
    I think it needs to insert some codes in current project.

    Regards,

    U-SK
  • Hi U-SK,

    I mixed the actions of appRecordAudio() with that of the appPlayAudio(). It was the appPlayAudio which needs to wait for a few frames to prevent the underflow. I think the reset of the input circular buffer should fix the problem.

    Let us know your test result.

    Ming

  • Hi Ming,

    Thank you for reply.
    I tried to clear codec input buffer, but the problem was not improved.

    I think that there is data somewhere in C5515 and I believe that if it is cleared the problem is solved.
    Does TI reproduce the same problem and have performed operation check?
    Would you please confirm where the data is left?

    Regards,

    U-SK
  • Hi,

    Do you have any updates about my question?

    Regards,

    U-SK
  • Hi,

    I'm sorry for keep asking.
    Do you have any updates about my question?

    Regards,
    U-SK