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

  Рет қаралды 13,365

Phil’s Lab

Phil’s Lab

Күн бұрын

Пікірлер: 49
@bubbasplants189
@bubbasplants189 4 ай бұрын
Thanks for sharing. You're a great teacher, better than some of my EE professors lol!
@PhilsLab
@PhilsLab 4 ай бұрын
Thank you very much! Haha sad state of affairs if that's the case..
@xy3986
@xy3986 4 ай бұрын
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 4 ай бұрын
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 4 ай бұрын
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 4 ай бұрын
​@@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 4 ай бұрын
Yep, that's something I can share once it's finished! I'm using the MIMXRT1776DVMAA (BGA-289 package).
@Bestcuriosity_1
@Bestcuriosity_1 4 ай бұрын
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 4 ай бұрын
Thank you very much for your kind comment!
@wolpumba4099
@wolpumba4099 4 ай бұрын
*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
@kiprof4350
@kiprof4350 4 ай бұрын
Thank you Phil, That's great Topic and Video!
@sumedhburbure4173
@sumedhburbure4173 4 ай бұрын
Very interesting video! Thank you for uploading these videos, it means alot!
@PhilsLab
@PhilsLab 4 ай бұрын
Thanks for your support!
@dazai7669
@dazai7669 4 ай бұрын
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 4 ай бұрын
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.
@sam42j
@sam42j 4 ай бұрын
damn nice. was looking for this stuff last week. 👍 thank you for these amazing tutorials.
@perceptron9834
@perceptron9834 3 ай бұрын
Battery powered sensor board would be also interesting 🙂
@akhilzachariahmathew9072
@akhilzachariahmathew9072 2 ай бұрын
Hi phil.. I am trying to design a filter that could filter out the decaying DC offsets. What would be mu best choice? Can u also suggest some must have tools for filter design? I’m a beginer so any information is useful information
@bebenlebricolo
@bebenlebricolo 4 ай бұрын
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 3 ай бұрын
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.
@andrewlloydwebber2616
@andrewlloydwebber2616 4 ай бұрын
Great video big dog!
@PhilsLab
@PhilsLab 4 ай бұрын
Thanks a lot!
@krisd9506
@krisd9506 4 ай бұрын
Have you tried any of the STM32G4 processors with the FMAC?
@luismiguelfrancisco824
@luismiguelfrancisco824 4 ай бұрын
Amazing man!
@PhilsLab
@PhilsLab 4 ай бұрын
Thank you, Luis!
@theengineer9910
@theengineer9910 4 ай бұрын
Thank you !
@PhilsLab
@PhilsLab 3 ай бұрын
Thanks for watching!
@santiall73
@santiall73 4 ай бұрын
Interesting topic ;)
@Dcl2037
@Dcl2037 4 ай бұрын
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 4 ай бұрын
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!
@meatballofall
@meatballofall 4 ай бұрын
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 4 ай бұрын
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.
@zer0g77
@zer0g77 4 ай бұрын
Why you need to reverso order the taps since they are symmetric?
@PhilsLab
@PhilsLab 4 ай бұрын
For the case of symmetric kernels, sure there is no need. But there are plenty of cases where the kernel isn't symmetric.
@tariqsingh3747
@tariqsingh3747 4 ай бұрын
Does the use of block functionality degrade the latency?
@PhilsLab
@PhilsLab 4 ай бұрын
There will be always be a (small) latency with block-processing, e.g. for 256-sample block @ 48kHz ~5ms.
@vedantjadhav4525
@vedantjadhav4525 3 ай бұрын
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?
@thetechegg8859
@thetechegg8859 4 ай бұрын
Huge Fan! Would it be possible to create a USB interface for guitar with in-built DSP filters using an STM32?
@PhilsLab
@PhilsLab 4 ай бұрын
Thank you! Yes, I'm working on a STM32 USB + Audio device class implementation for a future video at the moment.
@marcoschas4259
@marcoschas4259 4 ай бұрын
@@PhilsLab if you do it multichannel, you will be the hero of the audio maker community
@dotnetforever
@dotnetforever 4 ай бұрын
Wanna try... But I don't have such audio devices to see frequency response.. Will try nano vna on low fr.
@PhilsLab
@PhilsLab 4 ай бұрын
If you have a function generator and oscilloscope, you can do similar tests, albeit not as quickly/simply.
@p_mouse8676
@p_mouse8676 4 ай бұрын
Just a simple audio interface will be fine
@mostafanfs
@mostafanfs 4 ай бұрын
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 4 ай бұрын
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.
@blacklion79
@blacklion79 4 ай бұрын
Why cannot library reverse coefficients by itself is a mistery!
@tamaseduard5145
@tamaseduard5145 4 ай бұрын
👍🙏❤️
@Syktox
@Syktox 4 ай бұрын
How To Write A Driver (Audio CODEC & I2C) - Phil's Lab #142
30:31
Phil’s Lab
Рет қаралды 21 М.
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 12 МЛН
From Small To Giant 0%🍫 VS 100%🍫 #katebrush #shorts #gummy
00:19
6. Finite Impulse Response - Digital Filter Basics
12:51
Akash Murthy
Рет қаралды 30 М.
Z-Transform - Practical Applications - Phil's Lab #27
26:02
Phil’s Lab
Рет қаралды 55 М.
Comb Filters & Delay Lines in Software (STM32) - Phil's Lab #124
29:12
I2C Hardware & PCB Design - Phil's Lab #132
34:50
Phil’s Lab
Рет қаралды 45 М.
FIR Filters on the STM32G4 Part 1
22:07
Easier In Practice
Рет қаралды 9 М.
Hacking a weird TV censoring device
20:59
Ben Eater
Рет қаралды 3,2 МЛН
Why The US is Struggling to Return to the Moon
19:55
Real Engineering
Рет қаралды 725 М.
FIR Filter Design and Software Implementation - Phil's Lab #17
30:35
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 12 МЛН