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.