269 views|0 replies

1237

Posts

66

Resources
The OP
 

【STM32H7S78-DK】Evaluation + DSP test [Copy link]

This post was last edited by dql2016 on 2024-10-10 21:22

STM32H7S78 uses the M7 core, supports double-precision floating-point DSP instructions, and has strong performance. You can usually add the DSP library in the STM32CubeMX configuration interface through the following method:

However, in actual testing, it is found that the STM32H7S78 cannot add the DSP library to the project using this method, so the only option is to manually download the DSP library and add it to the STM32CubeIDE project.

The digital signal library CMSIS-DSP provided by ARM can be downloaded from GitHub or found in the STM32Cube software package provided by ST. Since CMSIS-5.6.0 and later versions no longer provide compiled static libraries, in order to facilitate the download of CMSIS-5.6.0 version, focus on the following three folders after decompression:

The underlying libraries contained in the Lib folder include three compiler platforms: IAR, KEIL, and GCC. The letter l represents the little-endian address format, and b represents the big-endian address format (all STM32 processors are little-endian address format processors); the letter f represents the use of the floating-point processing unit (FPU)

The following three types are provided for the M7 core:

arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
arm_cortexM7l_math.lib (Cortex-M7, Little endian)
Here we use the first one.
The DSP library Source directory contains the source code of various mathematical operation libraries. If you use the method of adding source code, you can better use the optimization function of the compiler. This is also the reason why 5.6.0 no longer provides static libraries. Armcc v6 cannot optimize static lib.

1) BasicMathFunctions

Basic mathematical functions: Provides various basic operation functions of floating-point numbers, such as vector addition, subtraction, multiplication, and division.

2) CommonTables

Table of commonly used parameters for digital signal processing.

3) ComplexMathFunctions

Mathematical functions for complex number calculations.

4) ControllerFunctions

Control algorithm functions. Including sine-cosine, PID motor control, vector Clarke transform, vector Clarke inverse transform, etc.

5) FastMathFunctions

Mathematical functions for common fast algorithms.

6) Filtering Functions

Filter function functions, mainly FIR and LMS (least mean square) filter functions.

7) MatrixFunctions

Matrix processing functions. Including matrix addition, matrix initialization, matrix inverse, matrix multiplication, matrix scale, matrix subtraction, matrix transposition and other functions.

8) StatisticsFunctions

Statistical functions, such as finding the average, maximum, minimum, calculating the root mean square (RMS), calculating the variance/standard deviation, etc.

9) SupportFunctions

Supports functions such as data copy, conversion between Q format and floating point format, and conversion between Q arbitrary formats.

10) TransformFunctions

Transformation functions. Including complex FFT (CFFT)/complex inverse FFT (CIFFT), real FFT (RFFT)/real inverse FFT (RIFFT), and DCT (discrete cosine transform) and supporting initialization functions.

Add a DSP folder under the workspace directory:

Copy the three folders above, Include, Lib, and Source, to the DSP folder, as shown below:

Then specify the library path and header file path in STM32CubeIDE.

First add the static library:

Then add the static library path:

Add the header file reference path:

Add macro definition:

Enable the hardware floating point unit FPU:

Add header file:

#include "arm_math.h"

Add floating point operation test code:

//DSP库求均方根测试
static void DSP_RMS(void)
{
    float32_t pSrc[10] = {0.7060f, 0.0318f, 0.2769f, 0.0462f, 0.0971f, 0.8235f, 0.6948f, 0.3171f,0.9502f, 0.0344f};
    float32_t pResult;
    uint32_t pIndex;

    q31_t pSrc1[10];
    q31_t pResult1;

    q15_t pSrc2[10];
    q15_t pResult2;

    printf("******** stm32h7s78-dk eeworld dsp test ***********\r\n");

    arm_rms_f32(pSrc, 10, &pResult);
    printf("arm_rms_f32 : pResult = %f\r\n", pResult);

    /*****************************************************************/
    for(pIndex = 0; pIndex < 10; pIndex++)
    {
         pSrc1[pIndex] = rand();
    }
    arm_rms_q31(pSrc1, 10, &pResult1);
    printf("arm_rms_q31 : pResult = %d\r\n", pResult1);

    /*****************************************************************/
    for(pIndex = 0; pIndex < 10; pIndex++)
    {
         pSrc2[pIndex] = rand()%32768;
    }
    arm_rms_q15(pSrc2, 10, &pResult2);
    printf("arm_rms_q15 : pResult = %d\r\n", pResult2);
    printf("******************************************************************\r\n");
}

Call

The calculation results are in line with expectations, indicating that the DSP library has been correctly added to the project.

appendix:

stm32cubeide_workspace_dsp_test.7z (20.59 MB, downloads: 0)
This post is from stm32/stm8
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list