1.4.1 CMSIS-DSP Library
This topic describes the CMSIS-DSP Library.
Description
The Cortex Microcontroller System Interface Standard-DSP (CMSIS-DSP) Library is the ARM® DSP Math Library integrated with MPLAB Harmony. It can only be used for ARM Cortex cores M0 through M7.
The CMSIS-DSP Library contains functions implementing 16-bit (Q15) and 32-bit (Q31) fixed-point math, as well as 32-bit floating point (F32) math.
Functions included in the CMSIS-DSP Library include complex math, vector math, matrix math, digital filters, adaptive filters, control and transforms. In many cases, these functions require specific data structures to operate, which are detailed in the header file.
Using the Library
This topic describes the basic architecture of the CMSIS-DSP Library and provides information and examples on its use.
Interface Header File: arm_math.h
The interface to the DSP Fixed-Point library is defined in the arm_math.h header file. Any C language source (.c) file that uses the DSP Fixed-Point library must include arm_math.h.
Library Source Files
The CMSIS-DSP Library source files are provided in the dev_packs repo under:
packs\arm\CMSIS<Version Number>\CMSIS\DSP\Source
The source is not generated to the Harmony 3 project but will give the implementation details and the ability to rebuild the library.
Library Files
The CMSIS-DSP Library archive file is generated by MHC to the following project directory:
firmware\src\packs\CMSIS\CMSIS\DSP\Lib\GCC
The following prebuilt versions of the library are available:
libarm_cortexM0l_math.a
libarm_cortexM3l_math.a
libarm_cortexM4l_math.a
libarm_cortexM4lf_math.a
libarm_cortexM7l_math.a
libarm_cortexM7lfdp_math.a
libarm_cortexM7lfsp_math.a
The naming convention is as follows:
libarm_<ARM,cortex><core><codes>_math.a
The cores are: M0,M3,M4, or M7,
The codes are as follows:
<l,b> - little or big endian byte order
<dp,sp> – double or single precision
<f> - Floating Point Unit on
Configuring the Library using MHC
Provides information on using MPLAB Harmony Configurator (MHC) to configure the library.
Description
The library can be generated by the MPLAB Harmony Configurator to any MPLAB® Harmony 3 project that has the CMSIS Pack component, i.e. only MPLAB® Harmony 3 projects that target ARM processors. Select the CMSIS Pack component highlighted in from the Project Graph.
The Configuration Options window looks like the following, with the selection for the CMSIS-DSP Library.
The speed optimized library for the given processor will be generated to the project.
Library Overview
The library interface routines are divided into various sub-sections, which address one of the blocks or the overall operation of the CMSIS-DSP Library.
Basic Math Functions
Basic vector math functions.
Fast Math Functions
This set of functions provides a fast approximation to sine, cosine, and square root.
Complex Math Functions
This set of functions operates on complex data vectors. The data in the complex arrays is stored in an interleaved fashion (real, imaginary, real, imaginary, ...). In the API functions, the number of samples in a complex array refers to the number of complex values; the array contains twice this number of real values.
Filter
Implementation of biquad cascade, IIR Direct Form I and II Transposed, convolution, correlation, FIR, IIR Lattice, LMS, and Normalized LMS filter functions
Matrix Functions
This set of functions provides basic matrix math operations. The functions operate on matrix data structures.
Transforms
FFT, DCT Type IV, and Real FFT functions.
Statistical Functions
Maximum, Minimum, Mean, Power, RMS, Standard Deviation and Variance calculations.
Support Functions
Vector Copy, Vector Fill, and conversion between F32, Q15, Q32 and Q7 values.
Interpolation Functions
Linear and Bilinear interpolation functions.
Motor Control Functions
PID Motor Control and Vector Clark, Vector Park, and Vector Inverse.
The CMSIS-DSP Library uses fixed-point fractional functions to optimize execution speed. These functions limit the accuracy of the calculations to the bits specified for the function. Due to parallelism in some operations, the 16-bit version of the functions are more efficient than their 32-bit counterparts. In many cases both 16-bit and 32-bit functions are available to give the user the choice of balance between speed and functional resolution.
Floating point versions of the function are also available.
Library Interface
Provides information on the list of available functions and interfaces.
Description
Documentation of the available CMSIS-DSP Library functions and interfaces and their descriptions can be found at:
https://arm-software.github.io/CMSIS_5/DSP/html/modules.html