当前位置:网站首页>[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 .
边栏推荐
- Target detection - pytorch uses mobilenet series (V1, V2, V3) to build yolov4 target detection platform
- Deep anatomy of C language -- C language keywords
- 延迟初始化和密封类
- 从表中名称映射关系修改视频名称
- 生成器参数传入参数
- Report on Market Research and investment prospects of China's silver powder industry (2022 Edition)
- egg. JS directory structure
- 根据csv文件某一列字符串中某个数字排序
- 电脑清理,删除的系统文件
- Colorlog combined with logging to print colored logs
猜你喜欢
FairGuard游戏加固:游戏出海热潮下,游戏安全面临新挑战
marathon-envs项目环境配置(强化学习模仿参考动作)
MySQL learning record 10getting started with JDBC
MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object
Pointer advanced --- pointer array, array pointer
Analysis of the source code of cocos2d-x for mobile game security (mobile game reverse and protection)
UnsupportedOperationException异常
2022.02.13 - NC002. sort
[MySQL] log
Screenshot in win10 system, win+prtsc save location
随机推荐
China vanadium battery Market Research and future prospects report (2022 Edition)
704 二分查找
tree树的精准查询
MySQL learning record 07 index (simple understanding)
swagger设置字段required必填
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)
优秀的软件测试人员,都具备这些能力
egg. JS project deployment online server
sys.argv
有效提高软件产品质量,就找第三方软件测评机构
JVM 快速入门
Research Report on Market Research and investment strategy of microcrystalline graphite materials in China (2022 Edition)
移位运算符
Light of domestic games destroyed by cracking
ESP8266-RTOS物联网开发
Target detection - pytorch uses mobilenet series (V1, V2, V3) to build yolov4 target detection platform
The problem and possible causes of the robot's instantaneous return to the origin of the world coordinate during rviz simulation
Chrome浏览器的crash问题
How to conduct interface test? What are the precautions? Nanny level interpretation
被破解毁掉的国产游戏之光