TI中文支持网
TI专业的中文技术问题搜集分享网站

调用fixedpoint_dsp_library库执行IIR滤波器算法疑问?

/*************************************************拷贝至controlsuit,略做修改*********************************************************/
typedef struct {
void (*init)(void *); //!< Pointer to initialization function void (*calc)(void *); //!< Pointer to calculation function int32_t *coeff_ptr; //!< Pointer to filter coefficients
int32_t *dbuffer_ptr; //!< Delay buffer Pointer uint16_t nbiq; //!< Number of biquads
int32_t input; //!< Latest input sample
int32_t isf; //!< Input scale factor int32_t output32; //!< Filter output (Q30) int16_t output16; //!< Filter Output (Q15)
uint16_t qfmat; //!< Q format of coefficients}IIR5BIQ32;

typedef IIR5BIQ32 *IIR5BIQ32_Handle;
void IIR5BIQ32_init(IIR5BIQ32 *);
void IIR5BIQ32_calc(void *);

// LPF co-efficients for IIR32 module
#define IIR32_LPF_COEFF { \
0,248624377,0,20118017,20118017, \
-141524868,517372703,43749199,87498398,43749199, \
-228291242,583544331,35450657,70901314,35450657, \
-401770939,715847129,875854244,1751708488,875854244}

#define IIR32_LPF_ISF 288246535
#define IIR32_LPF_NBIQ 4
#define IIR32_LPF_QFMAT 29

const int32_t coeff[5*IIR32_LPF_NBIQ] = IIR32_LPF_COEFF;
#pragma DATA_SECTION(iir, "iirfilt");
IIR5BIQ16 iir = IIR5BIQ16_DEFAULTS;
int dbuffer[2*IIR16_LPF_NBIQ];

iir.dbuffer_ptr = dbuffer;
iir.coeff_ptr = (long *)coeff; iir.qfmat = IIR32_LPF_QFMAT;
iir.nbiq = IIR32_LPF_NBIQ; iir.isf = IIR32_LPF_ISF;

iir.init(&iir);

iir.calc(&iir);

*************************************************拷贝OVER*********************************************************/

程序运行中,断点查看时,发现执行iir.init(&iir),进入非法指令中断,程序无法正常运行,有如下几点疑问?

(1)是否采用IIR5BIQ16  iir = IIR5BIQ16_DEFAULTS进行初始化存在问题?

        如果采用如下初始化是否合适?

iir.init = (void(*)(void*))&IIR5BIQ32_init;
iir.calc = (void(*)(void*))&IIR5BIQ32_calc;

(2)TI提供了iir5biq32.asm的汇编程序,在工程中是否需要添加该汇编函数?(工程中已正常添加c28x_fixedpoint_dsp_library.lib库)

赞(0)
未经允许不得转载:TI中文支持网 » 调用fixedpoint_dsp_library库执行IIR滤波器算法疑问?
分享到: 更多 (0)