当前位置:网站首页>[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 .
边栏推荐
- 根据csv文件某一列字符串中某个数字排序
- 移位运算符
- Deep analysis of C language pointer
- 从表中名称映射关系修改视频名称
- Excellent software testers have these abilities
- [NVIDIA development board] FAQ (updated from time to time)
- Warning in install. packages : package ‘RGtk2’ is not available for this version of R
- gcc动态库fPIC和fpic编译选项差异介绍
- Sort according to a number in a string in a column of CSV file
- JS native implementation shuttle box
猜你喜欢
Screenshot in win10 system, win+prtsc save location
FairGuard游戏加固:游戏出海热潮下,游戏安全面临新挑战
pcd转ply后在meshlab无法打开,提示 Error details: Unespected eof
Process of obtaining the electronic version of academic qualifications of xuexin.com
2022.02.13 - NC002. sort
游戏解包的危害及资源加密的重要性
Computer cleaning, deleted system files
角色动画(Character Animation)的现状与趋势
Detailed explanation of heap sorting
【MySQL】日志
随机推荐
Revit 二次开发 HOF 方式调用transaction
Leetcode question brushing (5.31) string
Analysis of the source code of cocos2d-x for mobile game security (mobile game reverse and protection)
LDAP Application Section (4) Jenkins Access
Image,cv2读取图片的numpy数组的转换和尺寸resize变化
C语言双指针——经典题型
Introduction to the differences between compiler options of GCC dynamic library FPIC and FPIC
游戏解包的危害及资源加密的重要性
Sort according to a number in a string in a column of CSV file
如何进行接口测试测?有哪些注意事项?保姆级解读
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)
[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes
按位逻辑运算符
torch建立的网络模型使用torchviz显示
Generator parameters incoming parameters
【MySQL】鎖
Warning in install. packages : package ‘RGtk2’ is not available for this version of R
pytorch训练好的模型在加载和保存过程中的问题
How to conduct interface test? What are the precautions? Nanny level interpretation
@Jsonbackreference and @jsonmanagedreference (solve infinite recursion caused by bidirectional references in objects)