当前位置:网站首页>[embedded] cortex m4f DSP Library
[embedded] cortex m4f DSP Library
2022-07-06 08:42:00 【Curious baby · Quan】
Use CM4 Built in kernel FPU You need to add compilation options when compiling :--cpu Cortex-M4.fp, To enable FPU Instruction set , Otherwise, ordinary Thumb2 Instruction implementation DSP function . At the same time, you need to add macro definitions :ARM_MATH_CM4, This is in CMSIS DSP Library Of arm_math.h It uses .CMSIS DSP Library Can be in ARM The official website of :https://developer.arm.com/tools-and-software/embedded/cmsishttps://developer.arm.com/tools-and-software/embedded/cmsis
If you use MDK Words , Directly in Runtime Environment Add DSP library ,Floating Point Hardware choice Single Precision, Predefined macros plus ARM_MATH_CM4, In this way, the project is automatically added DSP library :
The Library above uses FPU Instruction set generated DSP library , The following is not used FPU Instruction set ......
DSP Library tests :
static float sin_out[256];
static float fft_mag[256];
static float fft_out[256];
static void DSP_Test()
{
#define FFT_LENGTH 256
arm_rfft_fast_instance_f32 S;
// Create a t=2S Sampling data within the clock , Number of sampling points FFT_LENGTH, Sampling period T=t/FFT_LENGTH, sampling frequency F=1/T
for(uint16_t i = 0; i < FFT_LENGTH; i++)
{
sin_out[i] = arm_sin_f32(i*2*3.1416f/128) + 0.3f*arm_sin_f32(i*2*3.1416f/16); //
}
for(uint16_t i = 0; i < FFT_LENGTH; i++)
{
LOGI("%.4f\r\n",sin_out[i]);
DDL_DelayUS(1000);
}
arm_rfft_fast_init_f32(&S, FFT_LENGTH); // initialization 1024 spot FFT Parameters
arm_rfft_fast_f32(&S,sin_out,fft_out,0); // Calculation FFT
arm_cmplx_mag_f32(fft_out,fft_mag, FFT_LENGTH); // Calculate the modulus
for(uint16_t i = 0; i < FFT_LENGTH / 2; i++)
{
LOGI("%4d %4.4f %4.4f\r\n", i, (float)i * 128 / FFT_LENGTH, fft_mag[i]);//frequency = N * sample frequency / FFT length
DDL_DelayUS(1000);
}
}
It turns out that Excel Drawing on top , Sample point image (1Hz Sine wave and 8Hz Sine wave superposition ):
FFT The result of the calculation is :
The two peaks correspond to 1Hz and 8Hz, Consistent with the frequency of the sampling point .
边栏推荐
- Deep analysis of C language pointer
- Swagger setting field required is mandatory
- The network model established by torch is displayed by torch viz
- MySQL learning records 12jdbc operation transactions
- Generator parameters incoming parameters
- 2022.02.13 - 238. Maximum number of "balloons"
- 根据csv文件某一列字符串中某个数字排序
- Unified ordering background interface product description Chinese garbled
- 个人电脑好用必备软件(使用过)
- View computer devices in LAN
猜你喜欢
2022.02.13 - NC002. sort
【MySQL】日志
Marathon envs project environment configuration (strengthen learning and imitate reference actions)
Roguelike game into crack the hardest hit areas, how to break the bureau?
Generator parameters incoming parameters
egg. JS project deployment online server
PC easy to use essential software (used)
【ROS】usb_ Cam camera calibration
CISP-PTE实操练习讲解
JVM performance tuning and practical basic theory - Part 1
随机推荐
【MySQL】锁
hutool优雅解析URL链接并获取参数
vb.net 随窗口改变,缩放控件大小以及保持相对位置
The problem and possible causes of the robot's instantaneous return to the origin of the world coordinate during rviz simulation
2022 Inner Mongolia latest construction tower crane (construction special operation) simulation examination question bank and answers
R language ggplot2 visualization: place the title of the visualization image in the upper left corner of the image (customize Title position in top left of ggplot2 graph)
【刷题】牛客网面试必刷TOP101
Visual implementation and inspection of visdom
torch建立的网络模型使用torchviz显示
Using pkgbuild:: find in R language_ Rtools check whether rtools is available and use sys The which function checks whether make exists, installs it if not, and binds R and rtools with the writelines
Tcp/ip protocol
MySQL learning record 10getting started with JDBC
sublime text中conda环境中plt.show无法弹出显示图片的问题
Deep anatomy of C language -- C language keywords
IOT -- interpreting the four tier architecture of the Internet of things
China's high purity aluminum target market status and investment forecast report (2022 Edition)
按位逻辑运算符
704 二分查找
Leetcode question brushing (5.31) string
Colorlog结合logging打印有颜色的日志