First, I'd like to thank the community for their help in the past. Every time I've posted here I've walked away with that much more knowledge. Being a new DSP programmer and still a student its been quite the resource.
Anyway, I've been working off of an audio pass through example kindly provided to me by the TI staff. Which is working perfectly. However, I'm essentially trying to replicate their buff copy function (Included below) with additional data processing in between the two buffers. However, I'm having issues...
My conclusions thus far:
1. The math and the filter in between functions as desired. Its run perfectly using a pre-allocated sine wave as an input.
2. Leading me to believe that I'm doing something wrong while handing the Real Time data stream.
3. The DMA registers seem to be working fine ala the buff copy giving me crisp audio pass through.
4. I've investigated using the circ_update etc in the programmers hand book and intend to replace some of my logic with that. Though it looks remarkably similar to what I'm trying to do irregardless.
My concerns:
1. Are my signal modifications too slow to keep with my buffer? How can I check this?
2. I understand my code is less than optimal I guess that ties in with 1.
3. I might be entirely ignorant of the process... Thats a reality...
If theres more information that I can provide please let me know and I'll respond ASAP. Its a rather large project and I've left out a good majority of it as to not overwhelm. I guess I'm mainly concerned with how my addtional operations in between the buffers affects the data stream (aka why I'm getting utter junk at my output).
Thank you again and thank for taking your time to read a lengthy post!
The Buff Copy Function for Reference:
void buff_copy(Int16 *input, Int16 *output, Int16 size)
{
Int16 i;
for(i =0; i<size; i++)
{
*(output + i) = *(input +i);
}
}
My Modified Function:
void run_lms(Float32 *TapWeight,Int16 *Xmit,Int16 *Rcv_input,Int16 *Rcv_error)
{
//mu is now #defined in ref_bypassdata.h
//Vector_Size is #defined in ref_bypassdata.h
//Delay is #defined in ref_bypassdata.h
//Internal Variabls
Int16 i;
Float32 Output;
Int16 k;
Int16 j;
Float32 Error;
Float32 Input_Scaled;
Float32 Error_Scaled;
Float32 ErrorInput;
Float32 Input;
for(k=0;k<(XMIT_BUFF_SIZE);k++)
{
j=k-1;
if(j<0)
{
//Handles the case when k-1 is less than the last buffer, so it loops back to the past values in the 44 45 46 47 8 range
j=XMIT_BUFF_SIZE;
}
//Ensure that if you get a 0 error, the correct output is loaded to the register
Output=*(Xmit+j)/Scale;
//Output=0;
for(i=0;i<(Vector_Size);i++)
{
j=k-i;
if(j<0)
{
//Handles the case when k-i is less than the last buffer, so it loops back to the past values in the 44 45 46 47 8 range
j=XMIT_BUFF_SIZE-i+k+1;
}
// Variable j is used to maintain the propper indexing of the input vector
//Using Scaled Version of Input
Input=*(Rcv_input+j);
Input_Scaled=(Input)/Scale;
Output+= *(TapWeight+i) * Input_Scaled;
}
Input=*(Rcv_input+k);
Input_Scaled=Input/Scale;
Error=Output+Input_Scaled;
for(i=0;i<(Vector_Size);i++)
{
j=k-i; j=k-i;
if(j<0)
{
//Handles the case when k-i is less than the last buffer, so it loops back to the past values in the 44 45 46 47 8 range
j=XMIT_BUFF_SIZE-i+k+1;
}
Input=*(Rcv_input+j);
Input_Scaled=Input/Scale;
*(TapWeight+i)+=mu * Input_Scaled * Error;
}
//^^ Can be commented out once the delay is confirmed.
*(Xmit+k)=Output*Scale;
}
To Clarify some variables:
Rcv_XXXX: are pointers to my incoming data stream buffer.
Xmit : is a pointer to my output buffer.