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.

MSP432使用CMSIS函数库,arm_fir_q15函数



MSP432使用CMSIS函数库,arm_fir_q15函数,在使用该函数滤波器是,为什么结果就是输入信号?有人用过该函数吗??可以指点一下吗

  • 你是说运算后的结果覆盖在了原始数据上的意思吗?
  • 而且建议楼主去MSP432的论坛里咨询
  • 不是运行结果就是不对
  • 建议楼主上传下相关代码
  • /* DriverLib Includes */
    #include "driverlib.h"

    /* Standard Includes */
    #include <stdint.h>
    #include <stdbool.h>
    #include "arm_math.h"
    #include "arm_const_structs.h"


    #define TEST_LENGTH_SAMPLES 320 /* 采样点数 */
    #define BLOCK_SIZE 320 /* 调用一次arm_fir_f32处理的采样点个数 */
    #define NUM_TAPS 28 /* 滤波器系数个数 */

    uint32_t blockSize = BLOCK_SIZE;
    uint32_t numBlocks = TEST_LENGTH_SAMPLES/BLOCK_SIZE; /* 需要调用arm_fir_f32的次数 */

    static int16_t testInput_q15_50Hz_200Hz[TEST_LENGTH_SAMPLES]={0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40,0,40,38,7,0,32,61,45,0,-21,0,21,0,-45,-61,-32,0,-7,-38,-40}; /* 采样点 */
    static int16_t testOutput[TEST_LENGTH_SAMPLES]; /* 滤波后的输出 */
    static int16_t firStateF32[BLOCK_SIZE + NUM_TAPS -1]; /* 状态缓存,大小numTaps + blockSize - 1*/

    /* 低通滤波器系数 通过fadtool获取*/
    int16_t firCoeffs32LP[NUM_TAPS] = {0,0,0,1,1,1,-1,-3,-5,-3,4,14,24,31,31,24,14,4,-3,-5,-3,-1,1,1,1,0,0,0};

    //int16_t firCoeffs32LP[NUM_TAPS]={0,0,0,0,0,0,0,-3,-5,-3,4,14,24,31,31,24,14,4,-3,-5,-3,-1,1,1,1,0,0,0};
    /*
    *********************************************************************************************************
    * 函 数 名: arm_fir_f32_lp
    * 功能说明: 调用函数arm_fir_f32_lp实现低通滤波器
    * 形 参:无
    * 返 回 值: 无
    *********************************************************************************************************
    */
    static void arm_fir_q15_lp(void)
    {
    arm_fir_instance_q15 S;

    /* 初始化结构体S */
    arm_fir_init_q15(&S,NUM_TAPS, &firCoeffs32LP, &firStateF32, blockSize);

    /* 实现FIR滤波 */
    arm_fir_q15(&S,&testInput_q15_50Hz_200Hz,&testOutput, blockSize);
    }


    void main(void)
    {
    /* Stop Watchdog */
    MAP_WDT_A_holdTimer();
    arm_fir_q15_lp();
    while(1);
    }
  • 这是我写的代码 不知道问题出在哪里
  • 建议您先读一下 DSP的 CMSIS Library内的相关说明,会有助于您理解arm_fir_q15

    arm-software.github.io/.../group__FIRLPF.html