当前位置:网站首页>[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 .
边栏推荐
- 查看局域网中电脑设备
- Sublime text in CONDA environment plt Show cannot pop up the problem of displaying pictures
- [MySQL] lock
- win10系统中的截图,win+prtSc保存位置
- Current situation and trend of character animation
- Leetcode skimming (5.29) hash table
- Bottom up - physical layer
- Research Report on supply and demand and development prospects of China's high purity aluminum market (2022 Edition)
- Roguelike游戏成破解重灾区,如何破局?
- 按位逻辑运算符
猜你喜欢

MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object

可变长参数

Current situation and trend of character animation

JVM quick start

Charging interface docking tutorial of enterprise and micro service provider platform

ROS compilation calls the third-party dynamic library (xxx.so)

【ROS】usb_cam相机标定

深度剖析C语言指针

JS inheritance method

C语言深度解剖——C语言关键字
随机推荐
Target detection - pytorch uses mobilenet series (V1, V2, V3) to build yolov4 target detection platform
marathon-envs项目环境配置(强化学习模仿参考动作)
UnsupportedOperationException异常
Fairguard game reinforcement: under the upsurge of game going to sea, game security is facing new challenges
hutool优雅解析URL链接并获取参数
Light of domestic games destroyed by cracking
Deep analysis of C language pointer
The problem and possible causes of the robot's instantaneous return to the origin of the world coordinate during rviz simulation
【Nvidia开发板】常见问题集 (不定时更新)
Shift Operators
Browser thread
如何进行接口测试测?有哪些注意事项?保姆级解读
Mobile phones and computers on the same LAN access each other, IIS settings
Swagger setting field required is mandatory
2022.02.13 - NC001. Reverse linked list
Computer cleaning, deleted system files
游戏解包的危害及资源加密的重要性
View computer devices in LAN
Warning in install. packages : package ‘RGtk2’ is not available for this version of R
Detailed explanation of heap sorting