当前位置:网站首页>[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 .
边栏推荐
- [2022 Guangdong saim] Lagrange interpolation (multivariate function extreme value divide and conquer NTT)
- 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
- Bitwise logical operator
- 广州推进儿童友好城市建设,将探索学校周边200米设安全区域
- The network model established by torch is displayed by torch viz
- @Jsonbackreference and @jsonmanagedreference (solve infinite recursion caused by bidirectional references in objects)
- LDAP Application Section (4) Jenkins Access
- Crash problem of Chrome browser
- Golang force buckle leetcode 1020 Number of enclaves
- pytorch训练好的模型在加载和保存过程中的问题
猜你喜欢
Current situation and trend of character animation
swagger设置字段required必填
【MySQL】锁
Verrouillage [MySQL]
【MySQL】鎖
The harm of game unpacking and the importance of resource encryption
Roguelike游戏成破解重灾区,如何破局?
可变长参数
被破解毁掉的国产游戏之光
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
随机推荐
Sort according to a number in a string in a column of CSV file
JS pure function
China polyether amine Market Forecast and investment strategy report (2022 Edition)
marathon-envs项目环境配置(强化学习模仿参考动作)
Deep learning: derivation of shallow neural networks and deep neural networks
ESP8266-RTOS物联网开发
Bitwise logical operator
Image,cv2读取图片的numpy数组的转换和尺寸resize变化
On the inverse order problem of 01 knapsack problem in one-dimensional state
企微服务商平台收费接口对接教程
Research Report on supply and demand and development prospects of China's high purity aluminum market (2022 Edition)
Colorlog combined with logging to print colored logs
vb.net 随窗口改变,缩放控件大小以及保持相对位置
优秀的软件测试人员,都具备这些能力
LDAP Application Section (4) Jenkins Access
Research Report on Market Research and investment strategy of microcrystalline graphite materials in China (2022 Edition)
电脑清理,删除的系统文件
Verrouillage [MySQL]
The network model established by torch is displayed by torch viz
What is CSRF (Cross Site Request Forgery)?