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.

FIR16 issue

Other Parts Discussed in Thread: CONTROLSUITE

Hi everyone,

I face to a problem with the FIR16 function on my F28069.

My point is my function is working in one case and it goes to ILLEGAL_ISR in the second case.

Here is how is defined my function :

#define	FFT_SIZE	2048
#define	FIR_ORDER	16


typedef struct { 
    long *coeff_ptr;        	/* Pointer to Filter coefficient */
    long *dbuffer_ptr;		/* Delay buffer ptr              */
    int	cbindex;		/* Circular Buffer Index         */
    int order;              	/* Order of the Filter           */
    int input;              	/* Latest Input sample           */ 
    int output;             	/* Filter Output                 */
    void (*init)(void *);   	/* Ptr to Init funtion           */
    void (*calc)(void *);   	/* Ptr to calc fn                */  
    }FIR16; 

FIR16	fir;


int	Buff_acq[4*FFT_SIZE];
int	Spectro[(FFT_SIZE/2)+1];
int     coeff_fidl[17]={ 0.0090*32767,  0.0131*32767,  0.0245*32767,  0.0416*32767,
			 0.0618*32767,  0.0822*32767,  0.0994*32767,  0.1109*32767, 
			 0.1150*32767,  0.1109*32767,  0.0994*32767,  0.0822*32767,  
			 0.0618*32767,  0.0416*32767,  0.0245*32767,  0.0131*32767,  
			 0.0090*32767 };
int     coeff_lb[17]={	0.05850*32767, 0.05850*32767, 0.05850*32767, 0.05850*32767,
			0.05850*32767, 0.05850*32767, 0.05850*32767, 0.05850*32767,
			0.05850*32767, 0.05850*32767, 0.05850*32767, 0.05850*32767,
			0.05850*32767, 0.05850*32767, 0.05850*32767, 0.05850*32767,
			0.05850*32767};


void fir_od16(int *src, int *coeff, int size)
{
	int i;
	long dbuffer[FIR_ORDER+1];

	fir.init=(void (*)(void *))FIR32_init;
	fir.calc=(void (*)(void *))FIR32_calc;
	fir.order=FIR_ORDER;
	fir.dbuffer_ptr=dbuffer;
	fir.coeff_ptr=(long *)coeff;
	fir.init(&fir);

	for (i=0;i<size;i++)
	{
		fir.input=src[i];
		fir.calc(&fir);
		src[i]=fir.output;
	}
}


fir_od16(Buff_acq, coeff_fidl, 4*FFT_SIZE);
fir_od16(Spectro, coeff_lb, ((FFT_SIZE/2)+1));

fir_od16(Buff_acq, coeff_fidl, 4*FFT_SIZE) is working fine while fir_od16(Spectro, coeff_lb, ((FFT_SIZE/2)+1)) isn't and leads to ILLEGAL_ISR...

Finally, a question about FIR function, what is the dbuffer ? (I have read it's the Delay buffer but how am I supposed to define it ? Is it done in the FIR init function ?)

Regards,

Alex

  • I would use TI dsp lib for F28x [...]\controlSUITE\libs\dsp

    You will find sample code and documentation there.

    Regards,
    Maciej 

  • Hi Maciej,

    I have obviously used the example code and customed it to fit in my project.

    As you can see, this code is just a slightly modified version of the example 2833x_FixedPoint_FIR16 (FixedPointLib from ControlSuite).

    But I still don't know what I should put in dbuffer.

    Regards,

    Alex

  • Hi Alex,

    Alex PEPY said:
    Finally, a question about FIR function, what is the dbuffer ? (I have read it's the Delay buffer but how am I supposed to define it ? Is it done in the FIR init function ?)

    dbuffer is the delay line for the filter. you have to allocated a vector of sufficient space to this pointer. The init function will zero out the delay buffer in preparation for the filtering operation

    Alex PEPY said:
    My point is my function is working in one case and it goes to ILLEGAL_ISR in the second case.

    I cant imagine the reason for the execution to go into the ILLEGAL_ISR unless it encounters a TRAP instruction. It is possible that one of your buffers might be overflowing and corrupting the stack overwriting the function's return address and causing the execution to jump to some unknown place. Try single stepping through the function to see at what point the ISR is taken.