打印
[MM32软件]

【MM32 eMiniBoard测评报告】+ 数字滤波FIR浮点库评测

[复制链接]
944|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
【MM32 eMiniBoard测评报告】+ 数字滤波FIR浮点库评测
步骤与FTT类似引入cmsis dsp库。
数据长度320,
x=sin(2*pi*20*t/320)
从mm32debug查看y输出的数据为:




mm32_fir_output_debug_window.png (28.85 KB )

mm32_fir_output_debug_window.png

使用特权

评论回复
沙发
叶春勇|  楼主 | 2020-5-13 17:12 | 只看该作者
matlab输出数据:

matlab_fir_output.jpg (377.66 KB )

matlab_fir_output.jpg

使用特权

评论回复
板凳
叶春勇|  楼主 | 2020-5-13 17:14 | 只看该作者
arm_fir_f32库输出与matlab基本差不多。
附工程文件:

MM32_FIR_F32.zip

322.66 KB

使用特权

评论回复
地板
叶春勇|  楼主 | 2020-5-13 17:15 | 只看该作者
#include "arm_math.h"
#include "MM32L0xx.h"
#include "math.h"
#define M_PI 3.1415926
#define NUM_TAPS 29
#define BLOCK_SIZE 32
#define LEN_OF_SIG 320

extern uint32_t SystemCoreClock;
volatile uint32_t ticks=0;
uint32_t numBlocks=LEN_OF_SIG/BLOCK_SIZE;

uint32_t blockSize=32;
static float32_t x[LEN_OF_SIG];
static float32_t y[LEN_OF_SIG];
static float32_t firStateF32[BLOCK_SIZE+NUM_TAPS-1];

const float32_t coeffs[29] = {
  -0.001822523074,-0.001587929321,1.226008847e-018, 0.003697750857, 0.008075430058,
   0.008530221879,-4.273456581e-018, -0.01739769801, -0.03414586186, -0.03335915506,
  8.073562366e-018,  0.06763084233,   0.1522061825,   0.2229246944,   0.2504960895,
     0.2229246944,   0.1522061825,  0.06763084233,8.073562366e-018, -0.03335915506,
   -0.03414586186, -0.01739769801,-4.273456581e-018, 0.008530221879, 0.008075430058,
   0.003697750857,1.226008847e-018,-0.001587929321,-0.001822523074
};

       
void SysTick_init()
{
    if (SysTick_Config(SystemCoreClock / 10000))
    {
        /* Capture error */
        while (1);
    }
    /* Configure the SysTick handler priority */
    NVIC_SetPriority(SysTick_IRQn, 0x0);//SysTick中断优先级设置
}

void SysTick_Handler(void)
{
        ticks++;
}

static void arm_fir_f32_lp(void)
{
        uint32_t i=0;
        arm_fir_instance_f32 S;
        float32_t *input,*output;
        input=&x[0];
        output=&y[0];
       
        arm_fir_init_f32(&S,NUM_TAPS,(float32_t *)&coeffs[0],&firStateF32[0],blockSize);
       
        for(i=0;i<numBlocks;i++)
        {
                arm_fir_f32(&S,input+(i*blockSize),output+(i*blockSize),blockSize);
        }
}
int main(void)
{
        uint32_t i=0;
        for(i=0;i<LEN_OF_SIG;i++)
        {
                x[i]=sin(2.0*M_PI*20*i/LEN_OF_SIG);
        }
        while(1)
        {
                arm_fir_f32_lp();
        }
}




使用特权

评论回复
5
叶春勇|  楼主 | 2020-5-13 18:35 | 只看该作者
用matlab命令行设计fir低通代码:
clear all;
clc;
fs=1000
fc=150
wc=2*fc/fs
b=fir1(28,wc)

使用特权

评论回复
6
叶春勇|  楼主 | 2020-5-13 18:37 | 只看该作者
用matlab,fdatool设计

fdatool_LP.jpg (237.41 KB )

fdatool_LP.jpg

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

151

主题

4800

帖子

49

粉丝