Sign in

username:

password:



Not a member?

Search adsp



Search tips

Subscribe to adsp



adsp by Keywords

AD1819 | AD7332 | ADSP-2106 | ADSP-21060 | ADSP-21065L | ADSP-2116 | ADSP-21160M | ADSP-2181 | ADSP-218x | ADSP-219 | ADSP-2199 | ADSP219 | BF531 | BF532 | BF533 | BF535 | Blackfin | FFT | JTAG | LDF | SDRAM | SHARC | SPORT | UART | VDSP++ | VisualDSP

Discussion Groups

Discussion Groups | Analog Devices DSPs | FIR on ADSP-21160

Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).

  

Post a new Thread

FIR on ADSP-21160 - Author Unknown - Sep 28 1:03:00 2001



Hi, guys.

Hope you can help ne. I have a program to implement acouple of FIR
filters on ADDS-21160 EzKit. When doing just the low pass filtering,
everything is fine. But when I implement both (Low pass for a channel,
Highpass for the other), nothing comes put from the codec (no sound at
all).

Could you help me to fix it, please?

Here is the code: /* ADSP-21160 System Register bit definitions */
#include "def21160.h"

#define TAPS 949 /* filter taps */

/*--------------------------------------------------------------------
-------*/

.segment /pm pm_data;

.var LP_Coeff[TAPS] = ".\Source\LPCoeff.dat"; /* low pass filter
coeffs */
.var HP_Coeff[TAPS] = ".\Source\HPCoeff.dat"; /* high pass filter
coeffs */

.endseg;

.segment /dm dm_data;

.var LP_Delay[TAPS]; /* low pass filter delay line */
.var HP_Delay[TAPS]; /* high pass filter delay line */

.endseg; .segment /pm pm_code;

.EXTERN RX_left_flag;
.EXTERN Left_Channel_In;
.EXTERN Right_Channel_In;
.EXTERN Left_Channel_Out;
.EXTERN Right_Channel_Out;
.GLOBAL process_audio;
.GLOBAL Filters_Init;

/* insert DAG initialization code for delay or filter buffers here */
Filters_Init:
// Initialize LP Filter
b0 = LP_Delay; l0 = @LP_Delay; // Pointer to
delay line
m1 = 1;

b8 = LP_Coeff; l8 = @LP_Coeff; // Pointer to
coeffs
m9 = 1;

r12 = 0; // Clear delay line
i3 = LP_Delay; l3 = 0;
lcntr = TAPS, do clear_LP until lce;
clear_LP:
dm(i3, 1) = r12;

// Initialize HP Filter
b2 = HP_Delay; l2 = @HP_Delay; // Pointer to
delay line
m3 = 1;

b10 = HP_Coeff; l10 = @HP_Coeff; // Pointer to
coeffs
m11 = 1;

r14 = 0; // Clear delay line
i3 = HP_Delay; l3 = 0;
lcntr = TAPS, do clear_HP until lce;
clear_HP:
dm(i3, 1) = r12;

rts;

/* ///////////////////////////////////////////////////////////////////
/////////////
*
* audio processing routine
*

* ////////////////////////////////////////////////////////////////////
////////////
*/

process_audio:

fir:
/* process Left Channel Input */
r1 = -31; /*
scale the sample to the range of +/-1.0 */
r0 = DM(Left_Channel_In); /*
get left input sample */
f0 = float r0 by r1; /*
convert to floating point */
r2 = DM(Right_Channel_In); /*
get left input sample */
f2 = float r2 by r1; /*
convert to floating point */

f8 = f0;
if FLAG2_IN jump no_filter; /* in
case we are in bypass mode, copy
to output */

// Set to LP Filter
b8 = LP_Coeff; l8 = @LP_Coeff; m3 = 1;
b0 = LP_Delay; l0 = @LP_Delay; m11 = 1;
do_LP_filtering:
r12=r12 xor r12, dm(i0,m1)=f0; /* clear f12,
put sample in
delay line */
f8=pass f12, f0=dm(i0,m1), f4=pm(i8,m9); /* clear f8,
get data & coef
*/

lcntr=TAPS-1, do LP_macloop until lce;
LP_macloop: f12=f0*f4, f8=f8+f12, f0=dm(i0,m1), f4=pm(i8,m9);

f12=f0*f4, f8=f8+f12; /* perform
the last multiply */
f8=f8+f12; /* perform
the last accumulate */
f9 = f8;

// Switch to HP filter
b8 = HP_Coeff; l8 = @HP_Coeff; m3 = 1;
b0 = HP_Delay; l0 = @HP_Delay; m11 = 1;
f8 = f2;
f10 = f2;

do_HP_filtering:
r12=r12 xor r12, dm(i0,m1)=f0; /* clear f12,
put sample in
delay line */
f8=pass f12, f0=dm(i0,m1), f4=pm(i8,m9); /* clear f8,
get data & coef
*/

lcntr=TAPS-1, do HP_macloop until lce;
HP_macloop: f12=f0*f4, f8=f8+f12, f0=dm(i0,m1), f4=pm(i8,m9);

f12=f0*f4, f8=f8+f12; /* perform
the last multiply */
f8=f8+f12; /* perform
the last accumulate */

exit_filter:
r1 = 31; /* scale the
result back up to MSBs */
r9 = fix f9 by r1; /* convert
back to fixed point */
r8 = fix f8 by r1;
DM(Left_Channel_Out) = r9; /* send
result to AD1819 DACs */
DM(Right_Channel_Out) = r8;

jump end_filter;

no_filter:
r1 = 31; /* scale the
result back up to MSBs */
r0 = fix f0 by r1; /* convert
back to fixed point */
r2 = fix f2 by r1;
DM(Left_Channel_Out) = r0; /* send
result to AD1819 DACs */
DM(Right_Channel_Out) = r2;

end_filter:
rts (db);
r4 = 0;
/* if selecting slower sample rates, this flag clear
instruction is required */
dm(RX_left_flag) = r4; /*
clear RX_left_flag since we have
processed incoming data */

.endseg;





(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )