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.

it doesn't work when i used f28035 with fir16 library from controlsuite

Other Parts Discussed in Thread: CONTROLSUITE

First I'm not good in English. So if there are something wrong, plz forgive me.

here is my problem
i want to use the code in a example for 28335  from control suite.
Witch is called 2833x_FixedPoint_FIR16.

i try to let it work on piccolo 28035 control card.
but it failed. it just run about half code. the calculation doesn't done.

it just halt.or jump to othere  address.(not sure)

when i halt it ,it  stopped at 0x3ff8cd. and the number calculated is always zero.

i 'm using ccs5.4 piccolo 28035

and i copy the code the setting and change cmd file's content as example

need a help  figure it out
thank you

my main.c file if it is useful.

/*
 * main.c
 */
#include "DSP28x_Project.h"
#include <fir.h>
#include "math.h"
#include "float.h"

#define FIR_ORDER   32
#define SIGNAL_LENGTH 100

#pragma DATA_SECTION(fir, "firfilt");
FIR16  fir= FIR16_DEFAULTS;

#pragma DATA_SECTION(dbuffer,"firldb");					// Delay buffer alignment
long dbuffer[(FIR_ORDER+3)/2];

#pragma DATA_SECTION(sigIn, "sigIn");					// Input/output buffer alignment
#pragma DATA_SECTION(sigOut, "sigOut");
int sigIn[SIGNAL_LENGTH];
int sigOut[SIGNAL_LENGTH];

#pragma DATA_SECTION(coeff, "coefffilt");				// Coefficients buffer alignment
long const coeff[(FIR_ORDER+3)/2];

int FIR16_LPF_TEST[FIR_ORDER+1];						// Temporary buffer for adjust odd order FIR
														// coefficients

float	RadStep = 0.1963495408494f;
float	Rad = 0.0f;

int xn,yn;

int main(void) {
	
	unsigned long i;
	int *p;

	int FIR_ORDER_REV;

	//InitSysCtrl();
	 DisableDog();
	p=(int *)coeff;

	FIR_ORDER_REV=FIR_ORDER;

	// FIR16_LPF_TEST initialization
	//This buffer is only used to adjust odd order FIR filter to even order.
	for(i=0;i<sizeof(FIR16_LPF32_TEST);i++)
	{
		FIR16_LPF_TEST[i]=FIR16_LPF32_TEST[i];	//Put coefficients into FIR16_LPF_TEST buffer
	}

	if(FIR_ORDER_REV%2!=0)				  		// If ODD Order FIR
	{
		FIR16_LPF_TEST[FIR_ORDER_REV]=0; 		// Added one zero to the end of the coefficient
	    FIR_ORDER_REV=FIR_ORDER_REV+1;	  		// order=order+1; order now becomes even number
	}

	/* FIR Generic Filter Initialisation    */
	       fir.order=FIR_ORDER_REV;
	       fir.dbuffer_ptr=dbuffer;
	       fir.coeff_ptr=(long *)coeff;
	       fir.init(&fir);

		   //Clean up coeff buffer
	       for(i=0;i<FIR_ORDER_REV*2;i=i+2)
	       {
				*(p+i)=0;
				*(p+i+1)=0;
	       }

	       //Clean up delay buffer
	       for(i=0;i<FIR_ORDER_REV*2;i=i+1)
	       {
				dbuffer[i]=0;
	       }

	       //Reorganize coefficient table
	       //If user would like to reorgainze the order of the coefficients outside this
		   //project, for example, in matlab and stored the reorganized coefficients in
		   //header file beforehand, this part is not necessarily.
	       //More details, please refer to Fixed Point DSP library manual
	       for(i=0;i<FIR_ORDER_REV;i=i+2)
	       {
	       		*(p+FIR_ORDER_REV-i-2)=FIR16_LPF_TEST[i/2];
	       		*(p+FIR_ORDER_REV-i-1)=FIR16_LPF_TEST[i/2+FIR_ORDER_REV/2];
	       }


	       // Generate sample waveforms:
		   Rad = 0.0f;

		   	for(i=0; i < SIGNAL_LENGTH; i++)
			{
				sigIn[i]  =0;          //
				sigOut[i] =0;
			}

		   //FIR calculation
		   for(i=0; i < SIGNAL_LENGTH; i++)
		   {
				xn=(int)(32768*(sin(Rad) + cos(Rad*2.3567))/2);          //Q15
				sigIn[i]=xn;
				fir.input=xn;//0.5 Q15 format
		        fir.calc(&fir);
		        yn=fir.output;
		        sigOut[i]=yn;
				Rad = Rad + RadStep;
		   }

	        while(1)
	        {
	        }


	return 0;
}
.