STM32 Real-Time FIR Filter Implementation (CMSIS DSP) - Phil's Lab

Поделиться
HTML-код
  • Опубликовано: 7 сен 2024

Комментарии • 48

  • @bubbasplants189
    @bubbasplants189 Месяц назад +12

    Thanks for sharing. You're a great teacher, better than some of my EE professors lol!

    • @PhilsLab
      @PhilsLab  Месяц назад +2

      Thank you very much! Haha sad state of affairs if that's the case..

    • @xy3986
      @xy3986 Месяц назад

      I'm quiet sure - some day "Professor Phil" will do it much better for his students !! 👍👍

  • @p_mouse8676
    @p_mouse8676 Месяц назад +4

    Although the QA403 is a wonderful device, it would be handy to let people know that most measurements can be done with just a decent audio interface for around $70-150
    Great video btw 👍🏻

  • @isaacclark9825
    @isaacclark9825 Месяц назад +1

    Audio stuff using the CMSIS Library! I think I am in love!! I use NXP M7 microcontrollers, and all this stuff is still directly useful! Great content.

    • @PhilsLab
      @PhilsLab  Месяц назад +1

      Thanks, Isaac! Actually working on one of those NXP i.MX RT designs at the moment for an audio project. Will be interesting to see how that compares to the H7...

    • @isaacclark9825
      @isaacclark9825 Месяц назад

      ​@@PhilsLab If that ends up being something you can share, I'd love to see a video about that. Are you using a BGA device?

    • @PhilsLab
      @PhilsLab  Месяц назад +1

      Yep, that's something I can share once it's finished! I'm using the MIMXRT1776DVMAA (BGA-289 package).

  • @Bestcuriosity_1
    @Bestcuriosity_1 Месяц назад +3

    loved all your videos series for Engineers like us ,who was not taught the real beauty of DSP and MCU and their integration in real life
    love fro India sir

    • @PhilsLab
      @PhilsLab  Месяц назад

      Thank you very much for your kind comment!

  • @perceptron9834
    @perceptron9834 Месяц назад

    Battery powered sensor board would be also interesting 🙂

  • @dazai7669
    @dazai7669 Месяц назад

    Hey Phil! I absolutely love your videos and are absolute game changers! Thank you so much for uploading these videos!
    P.S. it would be amazing to see a PCB design walkthrough for the infiniFX board!

    • @PhilsLab
      @PhilsLab  Месяц назад

      Thank you very much for watching! Yep, will be making a new rev of the board with a screen - then will make a hardware walkthrough.

  • @kiprof4350
    @kiprof4350 Месяц назад

    Thank you Phil, That's great Topic and Video!

  • @sumedhburbure4173
    @sumedhburbure4173 Месяц назад

    Very interesting video! Thank you for uploading these videos, it means alot!

    • @PhilsLab
      @PhilsLab  Месяц назад

      Thanks for your support!

  • @sandman94
    @sandman94 Месяц назад

    damn nice. was looking for this stuff last week. 👍
    thank you for these amazing tutorials.

  • @santiall73
    @santiall73 Месяц назад

    Interesting topic ;)

  • @wolpumba4099
    @wolpumba4099 Месяц назад

    *Summary*
    *What it's about:* This video demonstrates how to implement a Finite Impulse Response (FIR) filter on an STM32 microcontroller using the CMSIS DSP library for real-time audio processing.
    *Key Points:*
    * *0:00** FIR Filter Advantages:* FIR filters offer precise frequency response control, are stable, and can create complex filter shapes.
    * *3:06** CMSIS DSP Library:* This ARM library provides optimized DSP functions for Cortex microcontrollers, including FIR filtering, offering significant speed improvements over custom code.
    * *3:06** Implementation Steps:*
    1. *3:06** Download CMSIS files:* Get `arm_math.h` header and the appropriate pre-compiled library (`arm_cortexM7lf_math.lib` for single-precision floating point on STM32H7).
    2. *4:24** Add libraries to project:* Include the header file and link the library in your IDE (STM32CubeIDE in this case).
    3. *6:00** Understand CMSIS FIR functions:*
    * `arm_fir_init_F32()`: Initializes the FIR filter structure. Requires reversed coefficient order and a working buffer.
    * `arm_fir_f32()`: Performs the actual filtering on a block of input samples.
    4. *9:13** Write your code:*
    * Define kernel length, block size, and structures for the FIR instance, buffers, and kernel.
    * Write functions to initialize the filter (including kernel reversal), process audio blocks, and convert between integer and floating-point formats.
    5. *16:17** Design the filter:* Use tools like T-Filter to design your desired frequency response and generate filter coefficients.
    * *21:41** Real-time testing:* The video demonstrates the implemented filter working on a custom STM32H7 board, achieving results very close to the designed filter response.
    *Tools Used:*
    * STM32CubeIDE
    * CMSIS DSP Library (version 4)
    * T-Filter online filter design tool
    * Quant Asylum QA403 audio analyzer
    * Segger J-Link debugger
    *Tips:*
    * Remember to reverse the filter coefficient order before passing it to the initialization function.
    * Consider memory constraints and processing power when choosing your filter length.
    * Non-idealities in the system can affect real-world filter performance.
    i used gemini 1.5 pro to summarize the transcript

  • @krisd9506
    @krisd9506 Месяц назад

    Have you tried any of the STM32G4 processors with the FMAC?

  • @bebenlebricolo
    @bebenlebricolo Месяц назад

    Very nice video Phil!
    With your current infinity development platform, how many effects do you think you can chain with current hardware?
    Like equalizer > distortion > delay > reverb or some pipeline that'll mimick a pedalboard ? Or would you have many identical devices with different firmware instead?
    I have no idea how powerful those MCU are for those applications.

    • @isaacclark9825
      @isaacclark9825 10 дней назад

      I can provide some indication. The NXP iMX RT 1062 is a comparable processor. Using a 256 sample loop with a 48kHz sample rate, the processor can calculate two Schroeder reverbs, a pitch shifting effect, a noise gate and tremolo effect (both as described in past Phil's lab videos), a 128 sample FFT and inverse FFT along with a 64 sample FFT magnitude calculation in sequence without problem. The iMX RT 1176 that Phil discussed in the comments has a 50% more powerful Cortex M7 core and includes a second M4 core.
      A single STM32H7 processor can probably handle the DSP functions of a moderately powerful pedal board.

  • @theengineer9910
    @theengineer9910 Месяц назад

    Thank you !

    • @PhilsLab
      @PhilsLab  Месяц назад

      Thanks for watching!

  • @vedantjadhav4525
    @vedantjadhav4525 Месяц назад

    hey sir , i have a request for you . Can you make a video on how to create a custom pcb for stm32wl family and use its lora function in the pcb?

  • @meatballofall
    @meatballofall Месяц назад

    Hey so what's the deal with using 32-bit floats as your kernel type, specifying some 20 digits for each element, when only 10-12 digits of precision is realistic with this datatype at this magnitude? Looking at 13:50 here, Your very first coefficient for example, is diverging after the 12th digit, meaning the entire least-significant half of your coefficient is not at all being represented in the hardware. At such a long kernel length, won't this essentially result in a different filter than what was called for by your literal const declaration?

    • @PhilsLab
      @PhilsLab  Месяц назад

      Yes, this was just due to using TFilter that works with doubles, and me copying over the values directly without further processing/precision reduction. The reason I didn't do any editing to those values was for the sake of time, and the fact that the filter results are - typically - still very similar between theoretical and practical implementation. The 'precision-reduction-effects' of using floats was also mentioned briefly in the video. A better alternative would of course be to use the DP CMSIS libs, or use a filter design tool that works with SP floats.

  • @andrewlloydwebber2616
    @andrewlloydwebber2616 Месяц назад

    Great video big dog!

  • @Dcl2037
    @Dcl2037 Месяц назад

    Hey, great content as always! I wondered if you've looked into the STM32 FMAC hardware? Wouldn't be a nice hardware-agnostic demo like this, but maybe it would be interesting to compare the pure firmware FIR approach to hardware? I've seen it on the peripheral list but never used it myself. Not sure what the limitations might be. Thanks!

    • @PhilsLab
      @PhilsLab  Месяц назад

      Thanks! Haven't really used the FMAC terribly much, as it's typically a fixed-point implementation. Most of my DSP implementations are floating point and so far haven't had the need to use it. I definitely should explore that a bit more though!

  • @luismiguelfrancisco824
    @luismiguelfrancisco824 Месяц назад

    Amazing man!

    • @PhilsLab
      @PhilsLab  Месяц назад

      Thank you, Luis!

  • @zer0g77
    @zer0g77 Месяц назад

    Why you need to reverso order the taps since they are symmetric?

    • @PhilsLab
      @PhilsLab  Месяц назад

      For the case of symmetric kernels, sure there is no need. But there are plenty of cases where the kernel isn't symmetric.

  • @thetechegg8859
    @thetechegg8859 Месяц назад

    Huge Fan! Would it be possible to create a USB interface for guitar with in-built DSP filters using an STM32?

    • @PhilsLab
      @PhilsLab  Месяц назад +3

      Thank you! Yes, I'm working on a STM32 USB + Audio device class implementation for a future video at the moment.

    • @marcoschas4259
      @marcoschas4259 Месяц назад +1

      @@PhilsLab if you do it multichannel, you will be the hero of the audio maker community

  • @dotnetforever
    @dotnetforever Месяц назад

    Wanna try... But I don't have such audio devices to see frequency response.. Will try nano vna on low fr.

    • @PhilsLab
      @PhilsLab  Месяц назад +2

      If you have a function generator and oscilloscope, you can do similar tests, albeit not as quickly/simply.

    • @p_mouse8676
      @p_mouse8676 Месяц назад

      Just a simple audio interface will be fine

  • @tariqsingh3747
    @tariqsingh3747 Месяц назад

    Does the use of block functionality degrade the latency?

    • @PhilsLab
      @PhilsLab  Месяц назад

      There will be always be a (small) latency with block-processing, e.g. for 256-sample block @ 48kHz ~5ms.

  • @tamaseduard5145
    @tamaseduard5145 Месяц назад +1

    👍🙏❤️

  • @blacklion79
    @blacklion79 Месяц назад

    Why cannot library reverse coefficients by itself is a mistery!

  • @mostafanfs
    @mostafanfs Месяц назад

    Very informative. Two questions. Why would you need multiple passband and stopband? I kinda seem lost. Have you mentioned this on a video already? And is this why you had to use this specific library instead of implementing your own FIR (which you've done before)?

    • @PhilsLab
      @PhilsLab  Месяц назад +1

      Thanks! The filter in this video is just for demo purposes, to show how to design a somewhat-specific FIR filter - no particular practical application. The CMSIS library is faster than the 'naive' FIR filter implementation.

  • @Syktox
    @Syktox Месяц назад