Code Monkey home page Code Monkey logo

simple_fft's Introduction

Simple FFT for embedded use

This code implements a simple radix-2 decimation-in-time (DIT) in-place Fast Fourier Transform (FFT) algorithm for both real and complex valued sequences. It is specifically designed for embedded systems, utilizing floating and fixed-point arithmetic and precomputed twiddle factors to optimize performance.

Compared to KissFFT, this code offers a smaller memory footprint by utilizing a single buffer for both input and output (in-place transformation). It also avoids dynamic memory allocation, which can be problematic in small microcontrollers. However, it should be noted that KissFFT supports arbitrary length FFTs through the use of mixed-radix transforms.

This library has comparable performance to CMSIS-DSP on a Cortex-M0+ (rp2040). In more advanced processors with FPU and FMA instructions, like Cortex-M4 and Cortex-M7, it is expected to perform worse.

Features:

  • Supports real and complex valued sequences
  • Optimized for embedded systems
  • Utilizes floating and fixed-point arithmetic
  • Precomputed twiddle factors for improved performance
  • In-place computation for smaller memory footprint

Limitations:

  • Not highly optimized, intended for educational purposes
  • Only supports power-of-2 length FFTs
  • No input checking or array boundary validation

Usage:

This code was primarily developed for use with the Raspberry Pi Pico board, which lacks FPU and MAC instructions. For Cortex-M4 or M7 processors, such as STM32x4 or STM32x7, it is recommended to use the CMSIS-DSP library, which can take advantage of FPU and fixed-point DSP instructions.

The test code can be built using CMake and gcc or clang in Linux. Follow these steps:

  1. Run cmake -B build -D BUILD_TESTSET=1 to generate the makefiles.
  2. Run cmake --build build to build the code.
  3. Run build/testset/fft to run the test suite.

Please refer to the test files for usage examples. Note that no input checking or array boundary validation is performed in the functions.

Potential Applications:

  • "Overlap-save" or "Overlap-add" large FIR processing for efficient computation on IR simulators
  • Morse code detection and decoding

simple_fft's People

Contributors

rafaelgcpp avatar rafaelgcpp-petrobras avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.