Electoday 2025

ไมโครคอนโทรลเลอร์ => ARM Processors => Topic started by: tha on July 04, 2021, 07:28:44 AM

Title: STM32F1 CMSIS DSP
Post by: tha on July 04, 2021, 07:28:44 AM
https://www.st.com/en/embedded-software/stm32cubef1.html (https://www.st.com/en/embedded-software/stm32cubef1.html)

โหลดโปรแกรมมาแล้วดู CMSIS DSP ตามไฟล์นี้ครับ

file:///D:/System%20Workbench/STM32CubeF1-master/Drivers/CMSIS/docs/DSP/html/index.html (http://file:///D:/System%20Workbench/STM32CubeF1-master/Drivers/CMSIS/docs/DSP/html/index.html)

CMSIS DSP Software Library

Introduction

user manual นี้อธิบาย the CMSIS DSP software library, ซึ่งเป็นชุดของ common signal processing functions สำหรับใช้กับ Cortex-M processor based devices.

The library ถูกแบ่งออกเป็นจำนวนหนึ่งของ functions ซึ่งแต่ละครอบคลุมหมวดหมู่เฉพาะ :

•   Basic math functions
•   Fast math functions
•   Complex math functions
•   Filters
•   Matrix functions
•   Transforms
•   Motor control functions
•   Statistical functions
•   Support functions
•   Interpolation functions

The library มีฟั่งชั่นที่แยกกันสำหรับการทำงานบน 8-bit integers, 16-bit integers, 32-bit integer and 32-bit floating-point values.

Using the Library

The library installer บรรจุ prebuilt versions ของ the libraries ใน the Lib folder.

•    arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
•    arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)
•    arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
•    arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)
•    arm_cortexM7l_math.lib (Cortex-M7, Little endian)
•    arm_cortexM7b_math.lib (Cortex-M7, Big endian)
•    arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)
•    arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)
•    arm_cortexM4l_math.lib (Cortex-M4, Little endian)
•    arm_cortexM4b_math.lib (Cortex-M4, Big endian)
•    arm_cortexM3l_math.lib (Cortex-M3, Little endian)
•    arm_cortexM3b_math.lib (Cortex-M3, Big endian)
•    arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)
•    arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)
•    arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian)
•    arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian)
•    arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit)
•    arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions)
•    arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating
     Point Unit)

The library functions ถูกประกาศใน the public file arm_math.h ซึ่งถูกวางใน the Include folder.  ง่ายต่อการรวมไฟล์นี้และเชื่อมโยง the appropriate library ใน the application และเริ่มการเรียก the library functions. The Library รองรับ single public header file arm_math.h สำหรับ Cortex-M core ด้วย little endian และ big endian. header file เดียวกันนี้จะถูกใช้สำหรับ floating point unit(FPU) variants. Define(กำหนด) the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or ARM_MATH_CM0 or ARM_MATH_CM0PLUS ขึ้นอยู่กับ the target processor ใน the application. สำหรับ Armv8-M cores define(กำหนด) preprocessor macro ARM_MATH_ARMV8MBL or ARM_MATH_ARMV8MML. เซ็ต preprocessor macro __DSP_PRESENT ถ้า Armv8-M Mainline core รองรับ DSP instructions.
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 04, 2021, 08:40:16 AM
Examples

The library ส่งออกพร้อมด้วยตัวอย่างจำนวนหนึ่งซึ่งแสดงวิธีใช้ the library functions.

Toolchain Support

The library ถูกพัฒนาและทดสอบด้วย MDK-ARM version 5.14.0.0. The library กำลังถูกทดสอบใน GCC and IAR toolchains และอัปเดตบนการกระทำนี้จะถูกทำให้มีใช้ประโยชน์ได้โดยเร็ว.

Building the Library

The library installer บรรจุ project files เพื่อสร้างใหม่ libraries บน MDK Tool chain ใน the CMSIS\DSP_Lib\Source\ARM folder.

•   arm_cortexM_math.uvprojx

The libraries สามารถถูกสร้างโดยการเปิด the arm_cortexM_math.uvprojx project in MDK-ARM, เลือก a specific target, และกำหนด the optional preprocessor macros ตามรายละเอียดข้างบน.

Pre-processor Macros

แต่ละ library project มี pre-processor macros ที่แตกต่างกัน.

•   UNALIGNED_SUPPORT_DISABLE:
Define มาโคร UNALIGNED_SUPPORT_DISABLE, ถ้า the silicon ไม่ได้รองรับ unaligned memory access

•   ARM_MATH_BIG_ENDIAN:
Define มาโคร ARM_MATH_BIG_ENDIAN เพื่อสร้าง the library สำหรับ big endian targets. โดยค่าเริ่มต้น library สร้างสำหรับ little endian targets.

•   ARM_MATH_MATRIX_CHECK:
Define มาโคร ARM_MATH_MATRIX_CHECK สำหรับการเช็คบน the input and output sizes ของ matrices

•   ARM_MATH_ROUNDING:
Defineมาโคร ARM_MATH_ROUNDING สำหรับการปัดเศษบนฟังชั่นที่สนับสนุน

•   ARM_MATH_CMx:
Define มาโคร ARM_MATH_CM4 สำหรับการสร้าง the library บน Cortex-M4 target, ARM_MATH_CM3 สำหรับการสร้าง the library บน Cortex-M3 target and ARM_MATH_CM0 สำหรับการสร้าง the library บน cortex-M0 target ARM_MATH_CM0PLUS สำหรับการสร้าง library on Cortex-M0+ target, and ARM_MATH_CM7 สำหรับการสร้าง the library on cortex-M7.

•   ARM_MATH_ARMV8MxL:
Define มาโคร ARM_MATH_ARMV8MBL for building the library on Armv8-M Baseline target, ARM_MATH_ARMV8MML for building library on Armv8-M Mainline target.

•   __FPU_PRESENT:
เริ่มต้นมาโคร __FPU_PRESENT = 1 เมื่อสร้างบน FPU supported Targets. เปิดการใช้งานมาโครนี้สำหรับ floating point libraries

•   __DSP_PRESENT:
เริ่มต้นมาโคร __DSP_PRESENT = 1 เมื่อ Armv8-M Mainline core รองรับ DSP instructions.

CMSIS-DSP in ARM::CMSIS Pack

ไฟล์ต่อไปนี้ที่เกี่ยวข้องกับ CMSIS-DSP มีอยู่ใน the ARM::CMSIS Pack directories :

(https://i.imgur.com/43XrnNK.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 04, 2021, 08:57:47 AM
file:///D:/System%20Workbench/STM32CubeF1-master/Drivers/CMSIS/docs/DSP/html/group__ComplexFFT.html (http://file:///D:/System%20Workbench/STM32CubeF1-master/Drivers/CMSIS/docs/DSP/html/group__ComplexFFT.html)

(https://i.imgur.com/XUHYj9L.png)
(https://i.imgur.com/aUxHA4m.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 05, 2021, 07:34:06 AM
Description

The Fast Fourier Transform (FFT) เป็น an efficient algorithm สำหรับการคำนวณ the Discrete Fourier Transform (DFT). The FFT สามารถลำดับขนาดได้เร็วกว่า the DFT, โดยเฉพาะอย่างยิ่งสำหรับความยาวที่ยาว. The algorithms ที่แธิบายใน section นี้ทำงานบน complex data. ชุดที่แยกกันของ functions ถูกอุทิศเพื่อจัดการ real sequences.

มี algorithms ที่แยกกันสำหรับจัดการ floating-point, Q15, and Q31 data types. The algorithms มีให้ใช้สำหรับแต่ละ data type ถูกอธิบายถัดไป.

The FFT functions ทำงานแบบแทนที่. นั่นคือ, the array ที่เก็บ the input data จะถูกใช้เพื่อเก็บ the corresponding result อีกด้วย. The input data เป็นแบบ complex และบรรจุ 2*fftLen ค่าที่แทรกกันดังแสดงข้างล่าง.

{real[0], imag[0], real[1], imag[1],..}

The FFT result จะถูกบรรจุใน the same array และ the frequency domain values จะมี the same interleaving.
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 05, 2021, 08:57:13 AM
Floating-point

The floating-point complex FFT ใช้ a mixed-radix algorithm. หลาย radix-8 stages ถูกดำเนินการพร้อมด้วย a single radix-2 หรือ radix-4 stage, ตามต้องการ. The algorithm รองรับความยาวของ [16, 32, 64, ..., 4096] และแต่ละความยาวจะใช้ a different twiddle factor table.

The function ใช้ the standard FFT definition และ output values อาจเพิ่มขึ้นตาม a factor of fftLen เมื่อคำนวณ the forward transform. The inverse transform มีมาตราส่วน 1/fftLen เป็น part of the calculation และซึ่งตรงกันกับ the textbook definition ของ the inverse FFT.

Pre-initialized data structures บรรจุ twiddle factors และ bit reversal tables ถูกจัดให้และ defined ใน arm_const_structs.h. Include(รวม) header นี้ใน your function และจากนั้น pass หนึ่งของ the constant structures เป็น an argument ไปยัง arm_cfft_f32. ตัวอย่างเช่น :

arm_cfft_f32(arm_cfft_sR_f32_len64, pSrc, 1, 1)

คำนวณ a 64-point inverse complex FFT รวมทั้ง bit reversal. The data structures ถูกรักษาเป็น constant data และไม่ถูกแก้ไขในระหว่าง the calculation. The same data structure สามารถถูกใช้ซ้ำสำหรับหลาย transforms รวมทั้ง mixing forward และ inverse transforms.

ที่ปล่อยออกมาก่อนหน้านี้ของ the library จัดให้มี separate radix-2 and radix-4 algorithms ที่ทำงานบน floating-point data. functions เหล่านี้ยังคงถูกจัดให้แต่ถูกเลิกใช้แล้ว. ฟังก์ชันที่เก่ากว่าจะช้ากว่าและมีลักษณะทั่วไปน้อยกว่าฟังก์ชันใหม่.

ตัวอย่างการเริ่มต้นของค่าคงที่สำหรับฟังก์ชัน arm_cfft_f32 มีดังนี้:

(https://i.imgur.com/xCERfjn.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 05, 2021, 10:03:58 AM
Q15 and Q31

The floating-point complex FFT ใช้ a mixed-radix algorithm. หลาย radix-4 stages ถูกดำเนินการพร้อมด้วย a single radix-2, ตามต้องการ. The algorithm รองรับความยาวของ [16, 32, 64, ..., 4096] และแต่ละความยาวจะใช้ a different twiddle factor table.

The function ใช้ the standard FFT definition และ output values อาจเพิ่มขึ้นตาม a factor of fftLen เมื่อคำนวณ the forward transform. The inverse transform มีมาตราส่วน 1/fftLen เป็น part of the calculation และซึ่งตรงกันกับ the textbook definition ของ the inverse FFT.

Pre-initialized data structures บรรจุ twiddle factors และ bit reversal tables ถูกจัดให้และ defined ใน arm_const_structs.h. Include(รวม) header นี้ใน your function และจากนั้น pass หนึ่งของ the constant structures เป็น an argument ไปยัง arm_cfft_q32. ตัวอย่างเช่น :

arm_cfft_q31(arm_cfft_sR_q31_len64, pSrc, 1, 1)

คำนวณ a 64-point inverse complex FFT รวมทั้ง bit reversal. The data structures ถูกรักษาเป็น constant data และไม่ถูกแก้ไขในระหว่าง the calculation. The same data structure สามารถถูกใช้ซ้ำสำหรับหลาย transforms รวมทั้ง mixing forward และ inverse transforms.

ที่ปล่อยออกมาก่อนหน้านี้ของ the library จัดให้มี separate radix-2 and radix-4 algorithms ที่ทำงานบน floating-point data. functions เหล่านี้ยังคงถูกจัดให้แต่ถูกเลิกใช้แล้ว. ฟังก์ชันที่เก่ากว่าจะช้ากว่าและมีลักษณะทั่วไปน้อยกว่าฟังก์ชันใหม่.

ตัวอย่างการเริ่มต้นของค่าคงที่สำหรับฟังก์ชัน arm_cfft_q32 มีดังนี้:

(https://i.imgur.com/sFa07VG.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 05, 2021, 10:15:14 AM
Function Documentation

(https://i.imgur.com/Vqxqkjh.png)

Parameters
     [in]        *S           ชี้ไปยัง an instance ของ the floating-point CFFT structure.
     [in,out]      *p1        ชี้ไปยัง the complex data buffer ของขนาด 2*fftLen. การประมวลผลเกิดขึ้นแบบแทนที่.
     [in]        ifftFlag        flag ที่เลือก forward (ifftFlag=0) หรือ inverse (ifftFlag=1) transform.
     [in]   bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0) bit
                                     reversal of output.

Returns
     none.

(https://i.imgur.com/iGQKGFP.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 08:02:15 AM
(https://i.imgur.com/cQH89UU.png)

Parameters
     [in]        *S           ชี้ไปยัง an instance ของ the Q15 CFFT structure.
     [in,out]      *p1        ชี้ไปยัง the complex data buffer ของขนาด 2*fftLen. การประมวลผลเกิดขึ้นแบบแทนที่.
     [in]        ifftFlag        flag ที่เลือก forward (ifftFlag=0) หรือ inverse (ifftFlag=1) transform.
     [in]   bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0) bit
                                     reversal of output.

Returns
     none.

(https://i.imgur.com/DXLFcR8.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 08:06:57 AM
(https://i.imgur.com/7WzHabb.png)

Parameters
     [in]        *S           ชี้ไปยัง an instance ของ the fixed-point CFFT structure.
     [in,out]      *p1        ชี้ไปยัง the complex data buffer ของขนาด 2*fftLen. การประมวลผลเกิดขึ้นแบบแทนที่.
     [in]        ifftFlag        flag ที่เลือก forward (ifftFlag=0) หรือ inverse (ifftFlag=1) transform.
     [in]   bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0) bit
                                     reversal of output.

Returns
     none.

(https://i.imgur.com/Y4udVj4.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 08:54:01 AM
(https://i.imgur.com/oM49hPh.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_f32 และจะถูกลบออกในอนาคต

Parameters
     [in]        *S           ชี้ไปยัง an instance ของ the floating-point Radix-2 CFFT/CIFFT structure.
     [in,out]      *pSrc        ชี้ไปยัง the complex data buffer ของขนาด 2*fftLen. การประมวลผลเกิดขึ้นแบบแทนที่.

Returns
     none.

(https://i.imgur.com/0TDf18f.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 09:17:58 AM
(https://i.imgur.com/OSkgCAK.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_f32 และจะถูกลบออกในอนาคต

Parameters
     [in,out]    *S        ชี้ไปยัง an instance ของ the  floating-point CFFT/CIFFT structure.
     [in]          fftLen         ความยาวของ the FFT.       
     [in]        ifftFlag        flag ที่เลือก forward (ifftFlag=0) หรือ inverse (ifftFlag=1) transform.
     [in]        bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0)
                                               bit reversal of output

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter ifftFlag ควบคุมว่า a forward หรือ inverse transform ถูกคำนวณ. Set(=1) ifftFlag สำหรับการคำนวณของ CIFFT มิฉะนั้น CFFT ถูกคำนวณ

The parameter bitReverseFlag ควบคุมว่า output อยู่ใน normal order หรือ bit reversed order. Set(=1) bitReverseFlag สำหรับ output ถูกอยู่ใน normal order มิฉะนั้น output อยู่ใน bit reversed order.

The parameter fftLen ระบุความยาวของ CFFT/CIFFT process. Supported FFT Lengths คือ 16, 64, 256, 1024.

Function นี้ยังเริ่มต้น Twiddle factor table pointer และ Bit reversal table pointer อีกด้วย.

(https://i.imgur.com/5Ogv3nr.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 09:29:29 AM
(https://i.imgur.com/PJOnd86.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_q15 และจะถูกลบออกในอนาคต

Parameters
     [in,out]    *S        ชี้ไปยัง an instance ของ the Q15 CFFT/CIFFT structure.
     [in]          fftLen         ความยาวของ the FFT.       
     [in]        ifftFlag        flag ที่เลือก forward (ifftFlag=0) หรือ inverse (ifftFlag=1) transform.
     [in]        bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0)
                                               bit reversal of output

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter ifftFlag ควบคุมว่า a forward หรือ inverse transform ถูกคำนวณ. Set(=1) ifftFlag สำหรับการคำนวณของ CIFFT มิฉะนั้น CFFT ถูกคำนวณ

The parameter bitReverseFlag ควบคุมว่า output อยู่ใน normal order หรือ bit reversed order. Set(=1) bitReverseFlag สำหรับ output ถูกอยู่ใน normal order มิฉะนั้น output อยู่ใน bit reversed order.

The parameter fftLen ระบุความยาวของ CFFT/CIFFT process. Supported FFT Lengths คือ 16, 64, 256, 1024.

Function นี้ยังเริ่มต้น Twiddle factor table pointer และ Bit reversal table pointer อีกด้วย.

(https://i.imgur.com/t8IExQw.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 09:38:08 AM
(https://i.imgur.com/sVoRsf5.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_q31 และจะถูกลบออกในอนาคต

Parameters
     [in,out]    *S        ชี้ไปยัง an instance ของ the Q31 CFFT/CIFFT structure.
     [in]          fftLen         ความยาวของ the FFT.       
     [in]        ifftFlag        flag ที่เลือก forward (ifftFlag=0) หรือ inverse (ifftFlag=1) transform.
     [in]        bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0)
                                               bit reversal of output

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter ifftFlag ควบคุมว่า a forward หรือ inverse transform ถูกคำนวณ. Set(=1) ifftFlag สำหรับการคำนวณของ CIFFT มิฉะนั้น CFFT ถูกคำนวณ

The parameter bitReverseFlag ควบคุมว่า output อยู่ใน normal order หรือ bit reversed order. Set(=1) bitReverseFlag สำหรับ output ถูกอยู่ใน normal order มิฉะนั้น output อยู่ใน bit reversed order.

The parameter fftLen ระบุความยาวของ CFFT/CIFFT process. Supported FFT Lengths คือ 16, 64, 256, 1024.

Function นี้ยังเริ่มต้น Twiddle factor table pointer และ Bit reversal table pointer อีกด้วย.

(https://i.imgur.com/9S8q2c7.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 09:51:13 AM
(https://i.imgur.com/t0dTNZx.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_q15 และจะถูกลบออกในอนาคต

Parameters
     [in]        *S        ชี้ไปยัง an instance ของ the fixed-point CFFT/CIFFT structure.
     [in,out]        *pSrc        ชี้ไปยัง the complex data buffer ของขนาด 2*fftLen. การประมวลผลเกิดขึ้นแบบแทนที่.

Returns
      none.

(https://i.imgur.com/hxqpQwV.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 10:24:30 AM
(https://i.imgur.com/dhhjZif.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_q31 และจะถูกลบออกในอนาคต

Parameters
     [in]        *S        ชี้ไปยัง an instance ของ the fixed-point CFFT/CIFFT structure.
     [in,out]        *pSrc        ชี้ไปยัง the complex data buffer ของขนาด 2*fftLen. การประมวลผลเกิดขึ้นแบบแทนที่.

Returns
      none.

(https://i.imgur.com/3dpYpqe.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 10:30:17 AM
(https://i.imgur.com/S07I3D4.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_f32 และจะถูกลบออกในอนาคต

Parameters
     [in]        *S        ชี้ไปยัง an instance ของ the floating-point Radix-4 CFFT/CIFFT structure.
     [in,out]        *pSrc        ชี้ไปยัง the complex data buffer ของขนาด 2*fftLen. การประมวลผลเกิดขึ้นแบบแทนที่.

Returns
      none.

(https://i.imgur.com/sJtRNI6.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 10:36:45 AM
(https://i.imgur.com/lfB1zBf.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_f32 และจะถูกลบออกในอนาคต

Parameters
     [in,out]    *S        ชี้ไปยัง an instance ของ the floating-point CFFT/CIFFT structure.
     [in]          fftLen         ความยาวของ the FFT.       
     [in]        ifftFlag        flag ที่เลือก forward (ifftFlag=0) หรือ inverse (ifftFlag=1) transform.
     [in]        bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0)
                                               bit reversal of output

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter ifftFlag ควบคุมว่า a forward หรือ inverse transform ถูกคำนวณ. Set(=1) ifftFlag สำหรับการคำนวณของ CIFFT มิฉะนั้น CFFT ถูกคำนวณ

The parameter bitReverseFlag ควบคุมว่า output อยู่ใน normal order หรือ bit reversed order. Set(=1) bitReverseFlag สำหรับ output ถูกอยู่ใน normal order มิฉะนั้น output อยู่ใน bit reversed order.

The parameter fftLen ระบุความยาวของ CFFT/CIFFT process. Supported FFT Lengths คือ 16, 64, 256, 1024.

Function นี้ยังเริ่มต้น Twiddle factor table pointer และ Bit reversal table pointer อีกด้วย.

(https://i.imgur.com/qeEY5SU.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 01:52:57 PM
(https://i.imgur.com/8ZF41YB.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_q15 และจะถูกลบออกในอนาคต

Parameters
     [in,out]    *S        ชี้ไปยัง an instance ของ the Q15 CFFT/CIFFT structure.
     [in]          fftLen         ความยาวของ the FFT.       
     [in]        ifftFlag        flag ที่เลือก forward (ifftFlag=0) หรือ inverse (ifftFlag=1) transform.
     [in]        bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0)
                                               bit reversal of output

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter ifftFlag ควบคุมว่า a forward หรือ inverse transform ถูกคำนวณ. Set(=1) ifftFlag สำหรับการคำนวณของ CIFFT มิฉะนั้น CFFT ถูกคำนวณ

The parameter bitReverseFlag ควบคุมว่า output อยู่ใน normal order หรือ bit reversed order. Set(=1) bitReverseFlag สำหรับ output ถูกอยู่ใน normal order มิฉะนั้น output อยู่ใน bit reversed order.

The parameter fftLen ระบุความยาวของ CFFT/CIFFT process. Supported FFT Lengths คือ 16, 64, 256, 1024.

Function นี้ยังเริ่มต้น Twiddle factor table pointer และ Bit reversal table pointer อีกด้วย.

(https://i.imgur.com/lD4jZla.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 02:02:43 PM
(https://i.imgur.com/ZyESzcX.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_q31 และจะถูกลบออกในอนาคต

Parameters
     [in,out]    *S        ชี้ไปยัง an instance ของ the Q31 CFFT/CIFFT structure.
     [in]          fftLen         ความยาวของ the FFT.       
     [in]        ifftFlag        flag ที่เลือก forward (ifftFlag=0) หรือ inverse (ifftFlag=1) transform.
     [in]        bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0)
                                               bit reversal of output

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter ifftFlag ควบคุมว่า a forward หรือ inverse transform ถูกคำนวณ. Set(=1) ifftFlag สำหรับการคำนวณของ CIFFT มิฉะนั้น CFFT ถูกคำนวณ

The parameter bitReverseFlag ควบคุมว่า output อยู่ใน normal order หรือ bit reversed order. Set(=1) bitReverseFlag สำหรับ output ถูกอยู่ใน normal order มิฉะนั้น output อยู่ใน bit reversed order.

The parameter fftLen ระบุความยาวของ CFFT/CIFFT process. Supported FFT Lengths คือ 16, 64, 256, 1024.

Function นี้ยังเริ่มต้น Twiddle factor table pointer และ Bit reversal table pointer อีกด้วย.

(https://i.imgur.com/iBIicrV.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 02:29:15 PM
(https://i.imgur.com/WHbjlka.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_q15 และจะถูกลบออกในอนาคต

Parameters
     [in]        *S        ชี้ไปยัง an instance ของ the Q15 CFFT/CIFFT structure.
     [in,out]        *pSrc        ชี้ไปยัง the complex data buffer. การประมวลผลเกิดขึ้นแบบแทนที่.

Returns
      none.

Input and output formats:

อินพุตภายในจะถูกลดขนาดลง 2 สำหรับทุก stage เพื่อหลีกเลี่ยง saturations ภายใน CFFT/CIFFT process. ดังนั้น the output format จะแตกต่างกันสำหรับ different FFT sizes. The input and output formats สำหรับ different FFT sizes และจำนวนของบิตที่จะเพิ่มสเกลถูกกล่าวถึงในตารางข้างล่างสำหรับ CFFT and CIFFT:

(https://i.imgur.com/900obKR.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 06, 2021, 02:38:10 PM
(https://i.imgur.com/TLE2kRw.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_cfft_q31 และจะถูกลบออกในอนาคต

Parameters
     [in]        *S        ชี้ไปยัง an instance ของ the Q31 CFFT/CIFFT structure.
     [in,out]        *pSrc        ชี้ไปยัง the complex data buffer ของขนาด 2*fftLen. การประมวลผลเกิดขึ้นแบบแทนที่.

Returns
      none.

Input and output formats:

อินพุตภายในจะถูกลดขนาดลง 2 สำหรับทุก stage เพื่อหลีกเลี่ยง saturations ภายใน CFFT/CIFFT process. ดังนั้น the output format จะแตกต่างกันสำหรับ different FFT sizes. The input and output formats สำหรับ different FFT sizes และจำนวนของบิตที่จะเพิ่มสเกลถูกกล่าวถึงในตารางข้างล่างสำหรับ CFFT and CIFFT:

(https://i.imgur.com/iWuIVWg.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 07, 2021, 07:29:14 AM
file:///D:/System%20Workbench/STM32CubeF1-master/Drivers/CMSIS/docs/DSP/html/group__RealFFT.html (http://file:///D:/System%20Workbench/STM32CubeF1-master/Drivers/CMSIS/docs/DSP/html/group__RealFFT.html)

(https://i.imgur.com/ilXp5Cy.png)
(https://i.imgur.com/CKmBfFg.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 07, 2021, 08:48:49 AM
Description

The CMSIS DSP library มี algorithms เฉพาะสำหรับคำนวณ the FFT ของ real data sequences. The FFT ถูกกำหนดครอบคุม complex data แต่ใน applications มากมาย the input เป็น real. Real FFT algorithms ใช้ประโยชน์จากคุณสมบัติสมมาตรของ the FFT และมีข้อได้เปรียบด้านความเร็วเหนือ complex algorithms ที่ความยาวเดียวกัน.

The Fast RFFT algorith ถ่ายทอดบน the mixed radix CFFT ที่ประหยัดการใช้ processor .

The real length N ส่งต่อไป FFT of a sequence ถูกคำนวณโดยใช้ขั้นตอนที่แสดงข้างล่าง.

                                (https://i.imgur.com/3nVwntJ.png)

The real sequence ถูกปฏิบัติเริ่มแรกเป็นถ้ามันเคยเป็น complex ที่กระทำ a CFFT. ต่อมา, a processing stage ปรับ the data ใหม่เพื่อให้ได้ครึ่งหนึ่งของ the frequency spectrum ใน complex format. ยกเว้น the first complex number ที่บรรจุ the two real numbers X[0] and X[N/2] the data ทั้งหมดเป็น complex. กล่าวอีกนัยหนึ่ง, the first complex sample บรรจุ two real values packed.

The input สำหรับ the inverse RFFT ควรคง the same format อย่าง the output of the forward RFFT. A first processing stage จะประมวลผล the data ก่อนเพื่อดำเนินการ an inverse CFFT ภายหลัง.

                                (https://i.imgur.com/4L97u1y.png)

The algorithms สำหรับ floating-point, Q15, and Q31 data แตกต่างกันเล็กน้อยและเราจะอธิบายแต่ละ algorithm ในทางกลับกัน.
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 07, 2021, 11:47:25 AM
Floating-point

The main functions คือ arm_rfft_fast_f32() and arm_rfft_fast_init_f32(). ฟังชั่นที่เก่ากว่า arm_rfft_f32() and arm_rfft_init_f32() ถูกเลิกใช้แล้วแต่ยังคงถูกบันทึกไว้.

The FFT ของ a real N-point sequence มีความสมมาตรแม้กระทั่งใน the frequency domain. ครึ่งที่สองของ the data เท่ากับ the conjugate ของ the first half ที่พลิกใน frequency. ดูที่ the data, เราจะเห็นว่าเราสามารถแสดง the FFT ได้โดยไม่ซ้ำกันโดยใช้เฉพาะ N/2 complex numbers เท่านั้น. สิ่งเหล่านี้ถูกบรรจุลงใน the output array ใน real and imaginary components สลับกัน :

X = { real[0], imag[0], real[1], imag[1], real[2], imag[2] ... real[(N/2)-1], imag[(N/2)-1 }

มันเกิดขึ้นที่ the first complex number (real[0], imag[0]) เป็นจำนวนจริงทั้งหมดจริงๆ. real[0] หมายถึง the DC offset, และ imag[0] ควรเป็น 0. (real[1], imag[1]) เป็น the fundamental frequency, (real[2], imag[2]) เป็น the first harmonic และต่อไป.

The real FFT functions จะบรรจุ the frequency domain data ในลักษณะนี้in this fashion. The forward transform ส่งออก the data ในรูปแบบนี้และ the inverse transform คาดว่า input data ในรูปแบบนี้. The function จะดำเนินการ the needed bitreversal เสมอเพื่อให้ the input and output data อยู่ใน normal order เสมอ. The functions รองรับ lengths of [32, 64, 128, ..., 4096] samples.
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 08, 2021, 08:01:42 AM
Q15 and Q31

The real algorithms ถูกกำหนดในลักษณะที่คล้ายกันและใช้ N/2 complex transforms เบื้องหลัง the scenes.

The complex transforms ใช้รวมภายในการปรับขนาดเพื่อป้องกัน fixed-point overflows. The overall scaling เท่ากับ 1/(fftLen/2).

A separate instance structure ต้องถูกกำหนดสำหรับแต่ละ transform ที่ใช้แต่ twiddle factor และ bit reversal tables สามารถถูกใช้ใหม่.

นอกจากนี้ยังมี an associated initialization function สำหรับแต่ละ data type. The initialization function ดำเนินการทำงานต่อไปนี้ :

•   เซ็ตค่าของ the internal structure fields.
•    เริ่มต้น twiddle factor table and bit reversal table pointers.
•    เริ่มต้น the internal complex FFT data structure.

การใช้ the initialization function เป็นตัวเลือก. อย่างไรก็ตาม, ถ้า the initialization function ถูกใช้, ดังนั้น the instance structure ไม่สามารถถูกวางลงใน a const data section. เพื่อวาง an instance structure ลงใน a const data section, the instance structure ควรถูกเริ่มต้นอย่าง manual ดังต่อไปนี้ :

arm_rfft_instance_q31 S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};
arm_rfft_instance_q15 S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};

โดยที่ fftLenReal คือความยาวของ the real transform; fftLenBy2 ความยาวของ the internal complex transform. ifftFlagR เลือก forward (=0) or inverse (=1) transform. bitReverseFlagR เลือก bit reversed output (=0) หรือ normal order output (=1). twidCoefRModifier ก้าวย่าง modifier สำหรับ the twiddle factor table. ค่าจะขึ้นอยู่กับ the FFT length; pTwiddleAReal ชี้ไปยัง the A array of twiddle coefficients; pTwiddleBReal ชี้ไปยัง the B array of twiddle coefficients; pCfft ชี้ไปยัง the CFFT Instance structure. The CFFT structure ต้องถูกเริ่มต้นด้วย. อ้างอิงถึง arm_cfft_radix4_f32() สำหรับรายละเอียดเกี่ยวกับ static initialization of the complex FFT instance structure.

end of RealFFT_Table group
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 08, 2021, 08:58:09 AM
(https://i.imgur.com/ofDWBdE.png)

เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_rfft_fast_f32 และจะถูกลบออกในอนาคต

Parameters
[in]     *S   ชี้ไปยัง an instance ของ the floating-point RFFT/RIFFT structure.
[in]     *pSrc   ชี้ไปยัง the input buffer.
[out]     *pDst   ชี้ไปยัง the output buffer.

Returns
       none

(https://i.imgur.com/nh6CxMx.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 08, 2021, 09:09:02 AM
(https://i.imgur.com/rtwcEI0.png)

Parameters
[in]   *S   ชี้ไปยัง an arm_rfft_fast_instance_f32 structure.
[in]   *p   ชี้ไปยัง the input buffer.
[in]   *pOut   ชี้ไปยัง the output buffer.
[in]   ifftFlag   RFFT ถ้า flag เป็น 0, RIFFT ถ้า flag เป็น 1

Returns
none.

(https://i.imgur.com/fy4ZfZu.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 08, 2021, 09:19:09 AM
(https://i.imgur.com/Tw348nX.png)

Parameters
[in,out]   *S   ชี้ไปยัง an arm_rfft_fast_instance_f32 structure.
[in]   fftLen   ความยาวของ the Real Sequence.

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter fftLen ระบุความยาวของ RFFT/CIFFT process. Supported FFT Lengths คือ 32, 64, 128, 256, 512, 1024, 2048, 4096.

Function นี้ยังเริ่มต้น Twiddle factor table pointer and Bit reversal table pointer อีกด้วย.

(https://i.imgur.com/rrynvgZ.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 08, 2021, 09:40:57 AM
(https://i.imgur.com/ecVEyqi.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 08, 2021, 09:45:29 AM
(https://i.imgur.com/Xob1e9U.png)

Parameters
[in,out]   *S   ชี้ไปยัง an instance of the Q15 RFFT/RIFFT structure.
[in]   fftLenReal     ความยาวของ the FFT.
[in]   ifftFlagR   flag ที่เลือก forward (ifftFlagR=0) หรือ inverse (ifftFlagR=1) transform.
[in]   bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0) bit reversal
                                        of output.

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter fftLenReal ระบุความยาวของ RFFT/RIFFT Process. Supported FFT Lengths คือ 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192.

The parameter ifftFlagR ควบคุมว่า a forward หรือ inverse transform ถูกคำนวณ. Set(=1) ifftFlagR เพื่อคำนวณ RIFFT, มิฉะนั้น RFFT ถูกคำนวณ.

The parameter bitReverseFlag ควบคุมว่า output อยู่ใน normal order หรือ bit reversed order. Set(=1) bitReverseFlag สำหรับ output ถูกอยู่ใน normal order มิฉะนั้น output อยู่ใน bit reversed order.

Function นี้ยังเริ่มต้น Twiddle factor table อีกด้วย.

(https://i.imgur.com/MKGC3kA.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 08, 2021, 10:11:41 AM
(https://i.imgur.com/BflCycu.png)

Parameters
[in,out]   *S   ชี้ไปยัง an instance of the Q31 RFFT/RIFFT structure.
[in]   fftLenReal     ความยาวของ the FFT.
[in]   ifftFlagR   flag ที่เลือก forward (ifftFlagR=0) หรือ inverse (ifftFlagR=1) transform.
[in]   bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0) bit reversal
                                        of output.

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter fftLenReal ระบุความยาวของ RFFT/RIFFT Process. Supported FFT Lengths คือ 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192.

The parameter ifftFlagR ควบคุมว่า a forward หรือ inverse transform ถูกคำนวณ. Set(=1) ifftFlagR เพื่อคำนวณ RIFFT, มิฉะนั้น RFFT ถูกคำนวณ.

The parameter bitReverseFlag ควบคุมว่า output อยู่ใน normal order หรือ bit reversed order. Set(=1) bitReverseFlag สำหรับ output ถูกอยู่ใน normal order มิฉะนั้น output อยู่ใน bit reversed order.

Function นี้ยังเริ่มต้น Twiddle factor table อีกด้วย.

(https://i.imgur.com/g4hizEW.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 08, 2021, 10:23:05 AM
(https://i.imgur.com/6EBi8im.png)

Parameters
[in]   *S   ชี้ไปยัง an instance of the Q15 RFFT/RIFFT structure.
[in]   *pSrc   ชี้ไปยัง the input buffer.
[out]   *pDst   ชี้ไปยัง the output buffer.

Returns
        none.

Input an output formats:

อินพุตภายในจะถูกลดขนาดลง 2 สำหรับทุก stage เพื่อหลีกเลี่ยง saturations ภายใน CFFT/CIFFT process. ดังนั้น the output format จะแตกต่างกันสำหรับ different RFFT sizes. The input and output formats สำหรับ different RFFT sizes และจำนวนของบิตที่จะเพิ่มสเกลถูกกล่าวถึงในตารางข้างล่างสำหรับ RFFT and RIFFT:

(https://i.imgur.com/fg95mSw.png)

(https://i.imgur.com/kFSI7zF.png)
Title: Re: STM32F1 CMSIS DSP
Post by: tha on July 08, 2021, 10:32:07 AM
(https://i.imgur.com/jtwsFxa.png)

Parameters
[in]   *S   ชี้ไปยัง an instance of the Q31 RFFT/RIFFT structure.
[in]   *pSrc   ชี้ไปยัง the input buffer.
[out]   *pDst   ชี้ไปยัง the output buffer.

Returns
        none.

Input an output formats:

อินพุตภายในจะถูกลดขนาดลง 2 สำหรับทุก stage เพื่อหลีกเลี่ยง saturations ภายใน CFFT/CIFFT process. ดังนั้น the output format จะแตกต่างกันสำหรับ different RFFT sizes. The input and output formats สำหรับ different RFFT sizes และจำนวนของบิตที่จะเพิ่มสเกลถูกกล่าวถึงในตารางข้างล่างสำหรับ RFFT and RIFFT:

(https://i.imgur.com/59KFGs5.png)

(https://i.imgur.com/MiVsMdJ.png)