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.

Combine two project audioSample.pjt and mmcsdSample.pjt

Other Parts Discussed in Thread: CCSTUDIO

Necessary to combine two of the project audioSample.pjt and mmcsdSample.pjt. The problem is the following. On the SD card has a wave file format. In memory of DSP is allocated a large buffer, then in an endless loop sequence reads this file to the allocated buffer and play it through the audio codec. The operation of reading a file from the SD card is successful, the function playing SIO_reclaim hangs in an endless  waiting for an empty buffer. I have such expectations, it is associated with the use of channels edma3. Example code:

5873.audio_mmcsd.txt

 

use:


1. CCStudio_v3.3

2. bios_5_41_00_06

3. pspdrivers_01_30_00_06


3. rtfs_1_10_02_32

 

Thanks

  • Alexander,

     

    First of all, while combining the pjt files, please take care of the configurations to be done keeping both the peripherals in mind (For Ex: Allocating the memory for heap, etc).

    If possible please share entire application, which will help us in analyzing the issue (Eg: .pjt, .tcf, .tci files).

    A quick look at the shared code seems that, you are calling SIO_reclaim(...) for the instream. But as per my understanding, you are just playing audio data (writing data to the audio device). So, since you are not doing a read, the instream creation is not required! SIO_reclaim(...) will hang(no data available for read) Could you please verify this?.

    If you are only writing to the audio codec, only outstream creation is enough.

    Let me know your comments on this.

     

    Thanks & Regards,

    Raghavendra

  • Raghavendra,

     

    In this particular case outstream not needed, but for the future challenges it will prove useful. From the documentation on the status issue / reclaim SIO_reclaim should return an empty buffer. To test, I deduced through the audio codec sin () with a frequency of 1000 Hz and it works fine. But when initialized mmcsd did read the SD card audio_write hung just to get an empty buffer. Project files:

    1. pjt: 7673.pjt.txt

    2. tcf: 2867.tcf.txt

    3. audio tci: 1682.audio_tci.txt

    4. rtfs tci: 6215.rtfs_tci.txt

    5. lib: 0407.lib.txt

    I think the problem is edma3.

     

    Thanks

  • Alexandr,

    As per my understanding,

    Alexandr Stolyarov said:
    To test, I deduced through the audio codec sin () with a frequency of 1000 Hz and it works fine.

    When you receive the audio data (audio_read()) and then call the audio_write(), the audio_write() comes out of the SIO_reclaim() graciously.

    Alexandr Stolyarov said:
    But when initialized mmcsd did read the SD card audio_write hung just to get an empty buffer

     But, whenever, the data is read from the SD card and then audio_write() is invoked, the audio write() is not able to come out of the SIO_reclaim().

    Is my understanding of the issue right? Please comment on this.

    Note: Whenever buffers are primed for outstream(Tx), the data will be written to the audio FIFO by the EDMA and then the event will be generated by the audio device (McBSP/McASP) to the EDMA. Once EDMA completes the transaction as per the PARAM set configuration (which will be set in the audio driver), the EDMA interrupt will be generated. In the EDMA completion interrupt handler, the registered callback function will be invoked (which will have the definition in the driver), the processed/empty buffer will be sent back to the application by invoking the callback function (This callback function is maintained in the driver whenever the the driver channel is opened).

    So, if in any case the SIO_reclaim() blocks, then first thing we must have to check is the EDMA interrupt/callback. Put a break point in the EDMA callback function and verify with the working as well as the non working scenario.

    Please try and let me know the result. 

    Thanks and Regards,

    Sandeep K

  • Sandeep K,

    Yes, you understood correctly.

    Audio codec for sending/receiving data using I2C.
    The I2C module is used to configure channels edma3. I added to my project I2C mode debug and set a breakpoint on the call back functions. Then started the project in execution, but the program did not go into any of these functions.

  • Alexandr,

    We always use the I2C in interrupt mode of operation , not in the EDMA mode of operation for audio application. Unless you have changed the mode of oeration, it will be in interrupt mode. So, please make sure the mode of operation of the I2C driver.

    Instead, you keep the breakppoint in the McASP driver code (inside the function Mcasp_localEdmaCallback()) and then verify.

    BTW, in your application, in both audio_write() and audio_read(), you are declaring Ptr *xmt OR Ptr *rcv, but i should have been Ptr xmt OR Ptr rcv.

    Let me know your comments on this.

    Regards,

    Sandeep K

  • Sandeep K,

     

    I launched the program to run. After initializing and reading the file did stop button Halt. Implementation of the program was discontinued in the function mcaspIsrOutput (mcasp.c) on the line "if (((Mcasp_XMT_UNDERRUN) == (Mcasp_XMT_UNDERRUN & chanHandle-> intStatus )))". The forum had read that it may be associated with stopping the process of generating data for the codec. The data for the codec should be formed even when you are reading from a file. I'll check it. 

    About the Ptr and Ptr *: and did so and so saw no difference.

     

    Alexander

  • Dear Sandeep K,

    I really need to solve this problem, because my work is stopped at this point. I would appreciate any information on this subject.
    Thank you.

     

    Alexander

  • Alexander,

    Just to isolate the possible conflict between the mmcsd and the audio. Is it possible you to write (instead of reading data from mmcsd) the sine tone to the audio and check if only the Tx is working fine or not?

    Thanks and Regards,

    Sandeep K

  • Sandeep K,

     

    I checked what you asked for. sin tone on the way out so good. I even inserted the code does not work with edma3 after audio_write and the program continued to operate. But once again I tried to read data from mmc program crashed at the codec output was nothing.

     

    Alexander

  • Alexander,

    Have you tried to use only one buffer for McASP? just for experiment!!

    Eg: #define NUMBUFS     1

    If there is any race condition, then, it would not happen when only one buffer being used by the McASP.

    Thanks and Regards,

    Sandeep K

  • Sandeep K,

     

    If NUMBUFS 1, then sin tone appears normal, provided that there is no need to fill the buffer before sending a signal to the codec.Otherwise, data are lacking and the output is corrupted sin tone. Even with NUMBUFS  2 sin tone appears normal. When you try to play the sin tone after reading data from mmcsd card program stops in a series of callbacks mcaspIsrOutput (mcasp.c) on the line

    if (((Mcasp_XMT_UNDERRUN) == (Mcasp_XMT_UNDERRUN & chanHandle-> intStatus)))
    {
         status = IOM_EBADIO;
         break;
    }

     

    Alexander