This post was last edited by dql2016 on 2021-1-16 16:59
The MCU used in the NUCLEO-L552ZE board is STM32L552ZET6. The STM32L552xx is based on the Cortex-M33 core , the Armv8-M with Mainline extension instruction set , and has a single-precision floating-point unit (FPU) . All data types support ARM single-precision data processing instructions and complete DSP instructions . It has excellent digital signal processing performance.
The firmware package STM32CubeL5 officially provided by ST contains a project for generating a DSP library, and users can use it to generate the lib library themselves.
STM32Cube_FW_L5_V1.3.0\Drivers\CMSIS\DSP\Projects\ARM\arm_cortexM_math.uvprojx
") rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;">
Generate the library file arm_ARMv8MMLldfsp_math.lib .
Or use the ST official generated
STM32Cube_FW_L5_V1.3.0\Drivers\CMSIS\DSP\Lib\ARM\arm_ARMv8MMLldfsp_math.lib
") rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;">
ProjectName\Drivers\CMSIS\DSP\Lib\ARM\arm_ARMv8MMLldfsp_math.lib
") rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;">
The file name means: Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit
Use stm32cubemx to create a blank project, add the lib library file arm_ARMv8MMLldfsp_math.lib and the include path ProjectName\Drivers\CMSIS\DSP\Include (the path where arm_math.h is located) to the project.
Use AC6 compiler, hardware single precision floating point.
Add USE_HAL_DRIVER,STM32L552xx,ARM_MATH_CM33,_FPU_USED=1U to Define
Also add -fshort-enums -fshort-wchar in Misc Controls
Otherwise, compilation fails.
The FFT calculation test code based on the official one is as follows:
#include "arm_math.h"
#include "arm_const_structs.h"
#include "main.h"
#define TEST_LENGTH_SAMPLES 2048
extern float32_t testInput_f32_10khz[TEST_LENGTH_SAMPLES];
static float32_t testOutput[TEST_LENGTH_SAMPLES/2];
uint32_t fftSize = 1024;
uint32_t ifftFlag = 0;
uint32_t doBitReverse = 1;
uint32_t refIndex = 213, testIndex = 0;
arm_status status;
float32_t maxValue;
uint32_t time1;
uint32_t time2;
int32_t test(void)
{
status = ARM_MATH_SUCCESS;
time1=HAL_GetTick();
arm_cfft_f32(&arm_cfft_sR_f32_len1024, testInput_f32_10khz, ifftFlag, doBitReverse);
arm_cmplx_mag_f32(testInput_f32_10khz, testOutput, fftSize);
arm_max_f32(testOutput, fftSize, &maxValue, &testIndex);
time2=HAL_GetTick();
if (testIndex != refIndex)
{
status = ARM_MATH_TEST_FAILURE;
}
if ( status != ARM_MATH_SUCCESS)
{
while (1);
}
printf("test ok,time=%dms\r\n",time2-time1);
while (1);
}
") rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;">
From the test results, it can be seen that it only takes 1 millisecond to complete the 1024-point FFT calculation, and the DSP performance is greatly improved compared to the M7 core.
Test Engineering:
stm32l552zet6qu_test.7z
(5.98 MB, downloads: 2)