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.

OMAP L137 problems with AIC3106 code sample

Other Parts Discussed in Thread: OMAP-L138

Dear community,

I use the OMAP L137 board with the C6747 and CCS v3.3.

I opened the AIC3106 project sample, which comes along by the TI installation (default folder:.../boards/evmc6747_v1/dsp) and copied the folder to the My_Projects folder. After setting up the compiler options (due to the other folder name) I deleted the files aic3106_loop_linein, aic3106_tone_headphone, aic3106_tone_lineout and their function call.

The file aic3106_loop_micin works.

I checked this by plugging the mic_in jack and checking the sound from the headphone out jack. I modified the file:

Origina code snippetl:

for ( sec = 0 ; sec < 5 ; sec++ )
    {
        for ( msec = 0 ; msec < 1000 ; msec++ )
        {
            for ( sample = 0 ; sample < 48 ; sample++ )
            {
                /* Read then write the left sample */
                while ( ! ( MCASP1_SRCTL0 & 0x20 ) );
                    sample_data = MCASP1_RBUF0_32BIT;
                while ( ! ( MCASP1_SRCTL5 & 0x10 ) );
                    MCASP1_XBUF5_32BIT = sample_data;

                /* Read then write the left sample */
                while ( ! ( MCASP1_SRCTL0 & 0x20 ) );
                    sample_data = MCASP1_RBUF0_32BIT;
                while ( ! ( MCASP1_SRCTL5 & 0x10 ) );
                    MCASP1_XBUF5_32BIT = sample_data;
            }
        }
    }

Modification:

//Transmit sound as long as switch is turned on

dip0 = EVMC6747_DIP_get( DIP_0);      //Get the value of DIP-Switch 0
   while( dip0 == DIP_DOWN)
 {
 
   dip0 = EVMC6747_DIP_get( DIP_0);      //Get the value of DIP-Switch 0  
   for ( sample = 0 ; sample < 48 ; sample++ )
            { 
                /* Read then write the left sample */
                while ( ! ( MCASP1_SRCTL0 & 0x20 ) );  //Check if [Receive Buffer bit] is empty
                    sample_data = MCASP1_RBUF0_32BIT;
                while ( ! ( MCASP1_SRCTL5 & 0x10 ) );  //Check for Tx ready <-[Transmit buffer ready bit]
                    MCASP1_XBUF5_32BIT = sample_data; 
            } 
 }

Question 1: Why is in the original file the routine for reading the data through the varialbe sample_data and the transmission of data twice in the loop?

Now to the main problem:

I downloaded the DSPLIB and included it in my project. I wanted to use the function void DSP_sp_fir_gen. I calculated a lowpass filter the 7th order with a normalized frequency of 0.0416 (=2kHz/48kHz) with MATLAB. I found out I would need some arrays: coefficients[8], input[55] and output[48]. In order to use the filter function I wanted to use following code:

for ( sample = 0 ; sample < 48 ; sample++ )          //READ
     { 
               while ( ! ( MCASP1_SRCTL0 & 0x20 ) );                    
              x_arr[sample] = MCASP1_RBUF0_32BIT;    
    }

calling the DSPLIB Fir function                           //Filter

for ( sample = 0 ; sample < 48 ; sample++ )    //WRITE
   {       
                  while ( ! ( MCASP1_SRCTL5 & 0x10 ) );
                  MCASP1_XBUF5_32BIT = y_arr[sample];      
   }

 This caused the problem that no sound was transmitted. I deleted the filter function call and replaced the y_arr with x_arr. So now I would write an array in the for loop and transmit the same (x_arr) in another for loop. The problem is that splitting the reading and writting part causing some constraints. But so far I know that have to write the input array first, then let the filter run over it and then transmit it.

Question 2: What do I need to change to call the FIR function or basically to read and write audio signal in real time using arrays, which are necessary for using the DSPLIB?

Thank you for your efforts.

 

  •  

    Lee

    . Lee said:
    Question 1: Why is in the original file the routine for reading the data through the varialbe sample_data and the transmission of data twice in the loop?

      I'm not sure, It does seems strange. It might be a typo, but it certainly doesn't seem the be the best way to read an an audio signal from McASP for real time constraints.

    The quickStartOMAPL1x_rCSL project has a McASPEcho Example which might be of use to reference. It was written on the OMAP-L138, but you should be able to quickly port it to the L137 by changing some address links in the header files.

     

    . Lee said:
    Question 2: What do I need to change to call the FIR function or basically to read and write audio signal in real time using arrays, which are necessary for using the DSPLIB?

     You would have to gather an array of audio samples(block processing), rather than processing for each sample  (sample based processing). Either way, I would start with some code that isn't depending on pooling to sample the audio as this isn't a good method.

  • Dear Drew Abuan,

    could you please be more precise about your answer of the second question? By checking the Transmit and Receive register and then writing or reading the sample data is sample based, but how can I implement block processing? The McASP data sheet wasn't very helpfull in clarifying my question. Are there any sample programs available that show how block processing works?

  • Lee,

     

        You can probably use C6Flo to create a simple audio block processing project , then reference the generated code. In general block processing is done by implementing a ping-pong buffer to collect the audio samples. Once you have collected the ping buffer, you can process the ping data while the pong buffer is filling up. Once the ping buffer is processed by the FIR you can output it through the McASP. This processing is them implemented on the pong buffer, while the ping buffer is filled up by McASP with new data.