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.

mcaspPlayBk with Filtering OMAPL138, C6748LCDK

Other Parts Discussed in Thread: OMAPL138

Hi Experts, 

This is with reference to my earlier post on filtering with buffered DMAs:  e2e.ti.com/.../536748

After plugging in the filter routine using DSPF_sp_fir_gen API, i get filtered outputs as expected in some cases. However there are periodic bleeps that happens in the background. Also, the filter routine (DSPF_sp_fir_gen + updating filter state ) works fine in non-real time. The issue is when the routine is plugged into the DMA based code. 

I need clarification on a couple of questions, could you kindly help:

1] I see that the format of data in the buffer pointed to by rxBufPtr[lastFullRxBuf]   is of the form [xxxx,0, xxxx,0, xxxx, 0, xxxx, 0...] considering 16 bit short array and "xxxx" being valid values. It's these values that i use as input to the filter routine DSPF_sp_fir_gen. Is this correct or do is there additional data interleaving of left and right channels that needs to be taken into consideration.  The rest of the code the the mcaspPlayBk  module remains "as-is" (i.e, WORDSIZE 16, SLOT_SIZE 16, NUM_I2S_CHANNELS 2)

2] The taps that are input to the filter  DSPF_sp_fir_gen API are right now in the range [-1 to 1] floating point values. Are there any restrictions here. 

3] Any inputs on why periodic bleeps appear in background? I presume the filter is meeting real-time as i do see predicted outputs for cases as well.

Thanks and any pointers/insights  would be helpful.

Regards

Smita

  • Hi Smita Shekar,

    I have notified our experts. They will get back to you shortly.
  • I am a little bit confused what exactly do you ask,  so please

    Specify what release you use

    What are the functions that you call

    what exactly you try to do

    Provided all the above I will be happy to help

    Ran

  • Hi Ran,

    Thanks for the response.

    This is with reference to the McaspPlyBk staterware code for the OMAPL138 / C6748 LCDK. I'm using the code as a base to plug in a FIR filter routine. The filter uses the tI API DSPF_sp_fir_gen. Right now i do get predicted responses after plugging in the filter routine in the DMA based staterware code. However, i do need clarifications on the questions below (at the bottom of the post). 

    I'm using CCS 6.1.2 and OMAPL138_StarterWare_1_10_04_01. 

     The FIR code snippet plugged into the main() function of the McaspPlayBk.c file  is as below:

    memcpy((short *)buftemp,(void *)rxBufPtr[lastFullRxBuf],
                               AUDIO_BUF_SIZE);
    
    for(idx1=0;idx1<NUM_SAMPLES_PER_AUDIO_BUF;idx1++)
    {
                inputDemoSignal[idx1+NUM_OF_TAPS-1]=(float)(buftemp[idx1*2]);
    }
    
    //Filter blockprocessing
    DSPF_sp_fir_gen(inputDemoSignal,coeffsFilter,outputDemoSignal,NUM_OF_TAPS, NUM_SAMPLES_PER_AUDIO_BUF);
    
    
    //Copy buffer for trasmit
    for(idx1=0;idx1<NUM_SAMPLES_PER_AUDIO_BUF;idx1++){
                   buftemp[idx1*2]= _spint(outputDemoSignal[idx1] * 65536) >> 16; //inputDemoSignal[idx1+NUM_OF_TAPS];   //=<<6
                   dataOutBufferFull[(idx%6144)++]=buftemp[idx1*2];
            }
    
    //Re-initialize filter state for next buffer processing
    for(idx1=0;idx1<NUM_OF_TAPS-1;idx1++)//idx1<NUM_OF_TAPS
                inputDemoSignal[idx1] = inputDemoSignal[NUM_SAMPLES_PER_AUDIO_BUF + idx1];
    
    
    //Copy data to transmit DMA buffer 
    memcpy((void *)txBufPtr[lastSentTxBuf],(void *)buftemp, AUDIO_BUF_SIZE);
    

    Further details regarding code and code snippet are below:

    - input, filter taps and output buffer are 8 byte aligned based on the documentation

    - input, filter taps and output buffer are floating point

    -buffer "buftemp" is of type short and is used to receive and transmit to the DMA buffers 

    - NUM_SAMPLES_PER_AUDIO_BUF has been set to 2048 

    -Sampling frequency: 8000

    The filter routine works fine in non-real time. When plugged into the McaspPlayBk starterware DMA based code, the input data are obtained from buffer pointed by rxBufPtr[lastFullRxBuf].  I would like clarification on the following:

    1. I see that the format of data in the buffer pointed to by rxBufPtr[lastFullRxBuf]   is of the form [xxxx,0, xxxx,0, xxxx, 0, xxxx, 0...] considering 16 bit short array and "xxxx" being valid values. It's these values that i use as input to the filter routine DSPF_sp_fir_gen. Is this correct or  is there additional data interleaving of left and right channels that needs to be taken into consideration.  The rest of the code the the mcaspPlayBk  module remains "as-is" (i.e, WORDSIZE 16, SLOT_SIZE 16, NUM_I2S_CHANNELS 2)

    2.  The taps that are input to the filter  DSPF_sp_fir_gen API are right now in the range [-1 to 1] floating point values. Are there any restrictions on the range of filter co-efficients to the  DSPF_sp_fir_gen routine. 

     Do let me know if you need more information.  Thanks much.

    Regards

    Smita

  • 1. It looks like the DMA transfer does not understand the structure of the rxBufPtr. Why don't you define it as int instead of short? Short is 2 bytes, int is 4 bytes, and try again.

    2. About the coefficients I can think about several reasons. But think what would happen if you multiply each coefficient by, say, 2.54 It does not change any feature of the output, only the units. (Think about it, if the values represents distance in inches, and you multiply the coefficients by ~2.54 your output is in centimeters). In any case, the filter's features depend on the relationships between the coefficients.

    Ran
  • Hi Ran, 

    Thanks for your inputs. 

    1. Yes, i did try accessing data as "int", but all values show up positive in the range 0 to 65535 . So it seems like it's expecting 16 bit short data (Left and Right channel configurations based on configurations to the the McASP/EDMA/Codec).  Also, is the  data in rxBufPtr iin compressed form? Is the Mcasp compressing data from the codec. We would like to access raw PCM data from the codec. Any insights/inputs here would help. 

    2. Yes of course, scaling filter taps would increase filter gain and correspondingly reflect in the output. I was just wondering if the DSPF_sp_fir_gen API was expecting the filter taps in a specific range. Good to know there is no restriction on range. 

    Looking forward to your inputs on 1.

    Regards

    Smita