当前位置:网站首页>[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/cmsis
https://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 .
边栏推荐
- China high purity silver nitrate Market Research and investment strategy report (2022 Edition)
- Fairguard game reinforcement: under the upsurge of game going to sea, game security is facing new challenges
- Hutool gracefully parses URL links and obtains parameters
- Precise query of tree tree
- C语言深度解剖——C语言关键字
- Image, CV2 read the conversion and size resize change of numpy array of pictures
- 按位逻辑运算符
- MySQL learning record 07 index (simple understanding)
- 如何有效地进行自动化测试?
- 优秀的软件测试人员,都具备这些能力
猜你喜欢

pcd转ply后在meshlab无法打开,提示 Error details: Unespected eof

Deep anatomy of C language -- C language keywords

【MySQL】鎖

Deep analysis of C language pointer

MySQL learning record 10getting started with JDBC

visdom可视化实现与检查介绍

JS native implementation shuttle box

sublime text中conda环境中plt.show无法弹出显示图片的问题

生成器参数传入参数

Deep analysis of C language data storage in memory
随机推荐
China high purity silver nitrate Market Research and investment strategy report (2022 Edition)
Hutool gracefully parses URL links and obtains parameters
pcd转ply后在meshlab无法打开,提示 Error details: Unespected eof
可变长参数
Excellent software testers have these abilities
Screenshot in win10 system, win+prtsc save location
[MySQL] database stored procedure and storage function clearance tutorial (full version)
Colorlog combined with logging to print colored logs
marathon-envs项目环境配置(强化学习模仿参考动作)
egg. JS directory structure
JVM 快速入门
LDAP應用篇(4)Jenkins接入
Problems in loading and saving pytorch trained models
生成器参数传入参数
JVM quick start
Introduction to the differences between compiler options of GCC dynamic library FPIC and FPIC
堆排序详解
Leetcode question brushing (5.31) string
The problem and possible causes of the robot's instantaneous return to the origin of the world coordinate during rviz simulation
C語言雙指針——經典題型