24:05 signal before the crossover 25:02 crossover two-way applied/ thank you so much for giving us this example it really does mean a lot of people like me that don't necessarily ingest code very well and are more of a visual and audible kind of folk.
I just reproduced your project. I used the WM8782 ADC with the same settings, it worked perfectly. The HAL complete callbak is already fixed in newer versions. Your video detailing the settings in STM32_Cube_IDE was very useful. Thank you very much for providing such educational material on this subject.
Fantastic video! Never knew I2S with DSP could perform so well at audio frequencies. Great walkthrough on how you learned and overcame some of the challenges you faced.
@@diggleboy You're welcome! I didn't want to be nosy but I also couldn't let the thought that 'someone is wrong on the internet' bug me during the night! :-^)
Thanks for taking the time to go through all the STM32CubeMX parameters, and offering the code as well. It has been invaluable to getting me past the WALL of ARM stuff, and has maid it much clearer to dive in and get things working. Skoll!
One thing worth noting, as I develop a similar project and I use this as an example, is that the callbacks with the default configuration are called twice per sample. One time they are called for Rx and one for Tx. In this example it doesn't matter as the code does the same thing twice with no consequences to data. However in my application I had counters and I would notice that they would count the double amount from what I ve seen on the analyzer. The workaround is to disable either Tx or Rx DMA interrupt so that the callbacks are called one time per half/full transfer.
did you just trust STM32 to finish handling each interrupt before moving to other ? or did you calculate how much time it would take to process data and compared to time it takes to fire each interrupt. I kind of got lost there. In case of FFT, where I believe you need to fill much bigger buffer (because of frequency resolution and etc) you would not process it before another RxReceived callback would be fired.
@@giorgitsintsadze9919 What I do in that project is double buffering because I dont want to mess up with timings and disabling interrupts. So in case of FFT you can have 2 buffers of same size. One should gather data from i2s until is full. Once full you would switch to the other buffer and simultaneously calculate fft on first buffer.
Really a great explanation! Hope you stay in the lane of audio processing, because there is little simple to understand information out there with code examples to look at etc. Really appreciate the video! Also a little PS: im really curious about the audio enhancement algorithms / for example the harmonic generator you showed of in your first video.
This is an excellent video. I searched for audio filtering with STM32. I wasn't disappointed as this jumped right into an actual implementation using cubemx.
Hi. Great video. I've been doing a lot of work with a DAC and looking to dabble in ADC. In your vid at around 9:30 you said the uC can't generate exactly 96kHz. Did you try to tune it in any further using the PLLI2S multiplier in Clock Config? (seen at ~7:50 at the bottom) You should be able to increase or decrease the multiplier a bit to tune the error percentage in closer to the target frequency. It usually won't pull it in exact, but it should be able to tune in to less then 1% error.
Hallo, eine Frage: am Anfang sagst du ja deine Master Ck ist 6,144MHz und deine BLCK ist 24,576 MHz. Aber in deiner Clock Configuration (7:55) hast du bei deiner I2S Clock 96 MHz eingestellt? Wie ergibt sich da der Zusammenhang? Und über welche Parameter steuert man die Bit und Master Clock? Liebe Grüße
Du hast natürlich recht - das ist bisschen verwirrend. Mit 96 MHz wurde das I2S Modul getaktet. Eigentlich keine valide Frequenz, wenn man die Audio-Clocks exakt treffen will. Korrekterweise hätte die Clock da z.B. 98.304 oder 49.152 MHz sein müssen. Damit würde man dann durch 2^x Teiler dann entsprechend die Frequenzen wie 24.576M, 96k, 48k, 6.144M treffen. Normalerweise reserviert man für das audio-clocking eine eigene PLL, die diese "krumme" Frequenz dann erzeugt. In dem Beispiel war die reale sampling-requenz dann eher 93.75 kHz statt 96k
Great video, thank you! I'm using an STM32F767ZI, it does not have full-duplex I2S interfaces but does have multiple half-duplex ones. Instead of HAL_I2SEx_TxRxCplt(), I have HAL_I2S_TxCplt() and HAL_I2S_RxCplt(), etc. For two half-duplex I2S interfaces do I need to make sure the transmitting interface is initiated / started first? Does it matter which interface is connected to the Pmod ADC and which to DAC? Does it matter which one is in master mode and which is in slave mode? Any pointers would help me out, thanks!
Great video! I'm a complete newbie here. I have a couple of questions. 1. Should the Pmodi2s2 be set as master mode or slave mode? 2. Should the VCC of Pmodi2s2 be connected to 3V or 5V output of STM32F407? 3. Is the LineIn of Pmodi2s2 connected to computer and LineOut connected to a headphone? Look forward to your answer. Thanks!
Hi, excellent project. I would ask about signal input and output to board. Are you connect signal output (from PC) direct to LINE IN on board and LINE OUT from board to microphone input on PC? I’m afraid about signals level. Could you describe how are you connect this ? Thanks.
Awesome! I should try it on ESP32 Also I find your another one video with reverberation very interesting. I had experiments in my childhood with IC chips. There was TTL like RAM for delay and a opam for ADC for implementing the reverberation machine. It was device sized like shoes box. Haha.. After four of mounts assemble and fix wired issue its had been working!
Great video. A couple of questions if I may. I saw that the I2S_ex drivers are available for the STM32F4 but not for the F7 - any ideas why that might be? The I2S support is there in Cube for F7 but the Full duplex mode isn't supported. Also - did you capture both the half and full complete callbacks to give you and extra window of processing? I didn't quite understand that. Anyway - great series of videos, thank you !
Thanks for your video. May I ask you the connection between the PMod I2S2 board and the STM32F407 Discovery board? I don't know where to connect the pins of the DAC of the I2S2. Thanks in advance!
very good!! Thank you, I did learn a lot! The ADC takes an Input of 0 - 3.3V. Do you use an op-amp adder with 1.5V at the ADC to allow for the AC audio input? How much CPU load does this example finally take? What is the heaviest load; the IIR filter, the int handling...?
I do have a question: did you ever compare the STM32F4 IIR filter response to the theoretical/calculated transferfunction? I find an offset of several hundert Hz and cant explain why (the true sampling freq. is lesss then 96kHz; but only 2% or so)...
Great video, I am going to use this as my introduction to DSP with a microcontroller! I was wondering what the input signal looks like? Can I use a bi-polar input or do I need to do the whole biasing thing between 0 - 3V's?
Excellent video! Is it really necessary with the "Master Clock Output" selection? I see that there are two lines that appear to have a clock signal: I2S2_CK and I2S2_MCK. Could you tell me the difference? Another thing: Have you set the DMA buffers to byte (8 bits), half word (16 bits) or word (32 bits)?
I guess I'll answer my own question: If the I2S unit has internal PLL it would suffice to disable the master clock output and use only the I2S2_CK line as input to the SCK of the unit. I think your setup use half word for the DMA, as this was working out nicely for me.
Thank you, I learned a lot! One question: The incoming i2s data stream is 24 bit left aligned, so I would have expected to see a shift right by 8 to restore the incoming data to how the processor interprets data (right aligned). int lSample = (int) (rxBuf[4]
I²S is transmitting the data in signed integer format (means 2's complement) with the sign-bit being transmitted directly at the beginning. In 32-bit integer, the sign-bit is also most MSB bit. Of course you could shift the data low by 8, but you have to care, that still the sign-bit is on the correct position for also 32-bit integer data type (means that is not just a bit-shift but an arithmetic bit-shift). In the end it doesn't care if all the data values are scaled up by 255 or not. The risk in my implementation for sure is that you can get faster numeric overflows then if you are near to clipping level.
Thank you, I will try, I would show you directly in the video how everything on the Board is tested. How much does Jack 3.5 need? There's only one on the Board, won't it be enough? 2) Is there a project implementation on SPL (LL)?
Yes there is an audio-codec on the board for audio output. However you don't have any audio input besides a microphone and you also have to configure the audio codec before with I2C. Using the PMOD I2S2 board here is quite more easier as you don't have to do software configurations first.
I have tried to follow along with this but am having trouble when connecting the PMOD ADC and DAC, and cannot seem to pass through audio. Do you have any recommendations or can you indicate how to wire this? I noticed the LR clock connection is not shown on your block diagram and want to know where this connection would be applied :)
I'm working on a project using STM32F411 Disco board, and it is connected via Fullduplex I2s and DMA like you described. I have a hard time getting the samples right and having math manipulations not corrupting the output. I'm stuck on this issue for 2 days now, and I watched your video & Phil's Lab's videos multiple times, and no matter what bitwise operation I perform on the input data, the output is getting corrupted. Can you maybe help me via a short zoom meeting? of chat about it privately ?
I still hope you would reply on how to generate correct audio clock... Is this even possible with STM32F series?! More than 2.34% deviation is unusable if I say want to stream predefined sample rate stream from USB for example. In fact, any deviation would be unacceptable in this case :( .
No, since that board has no i2s, i also was researshing for that, and according on this site:stm32duinoforum.com/forum/viewtopic_f_29_t_4181.html, there's some way to make it work with i2s, but it would mean more work.
@@asunavk69 Oh but thats for the final part of the video. I just need fft and FIR lowpass filters. I tried a low pass filter and it worked perfectly. Thanks for everything and continue with the good work.
@@YetAnotherElectronicsChannel yes i tried to build it :) but i am now reading it needs to enabled..however i am not sure where to do this. (seems it must be enabled via i2c?) anyway excellent videos.
how did you wire up your boards, because i wired them up with some jumpers and connected my headphones to the DAC. The result is that I can hear the music but I have noise.
As i don't have the exact same chip, My configuration does not end up being the same and so I just hear white noise. The callback line is not there as well as some peripheral related stuff. Help! --- Update: my setup only worked with half word for reasons I don't understand
Hi there. Can you suggest me a ST MCU that can process 7.1 audio (8ch) through 4 stereo I²S lines, streaming it to my DAC? I'm actually working on my final eng grad project and I need to process multi channel decoded audio comming from HDMI interface. It has been so hard to research such kind of content on YT. Nice video. Thanks!
Good work! Is (there) any way to configurate an I2S bus with LL drivers?I tried to build a project with stm32f303vct6, but there in the CubeMX ( "ProjectManager->advanced settings" ) is a one pukt next to I2S: it is HAL.
Loving these videos, very clear explanations! However, when I upload to my board the results are noisy af! Any tips? Wires leading to the DAC/ADC are short etc, not sure how you get such crisp recordings. I get some strange artefacts.
@@YetAnotherElectronicsChannel hello! Just loaded up your project files and uploaded. Same boards etc as you are using in your video! Will have a scope tonight and see if it's something obvious. A fellow audio and electronics enthusiast so love your videos!
Damon McCartney what I was doing always wrong is that I exchanged sometimes the datelines from/to ADC / DAC ... and for sure the clocking signals like MCLK, SCLK und WS are only available once on STM side but need to be spreaded to both ADC and DAC. The 3.3V supply can be taken directly from the STM32 board
Hello, congratulations on your work. what is the possibility of building a musical keyboard with stm32, how to do that. Can I play musical notes with this?grateful
@@robertbristow-johnson6362 aren't interrupt handlers supposed to be as fast as possible? All the heavy processing then is done in the main loop or separate task.
@@assertivebird No not necessarily. In real-time DSP, we would put all of the sample-by-sample processing in the interrupt handler. If we are processing samples in blocks, then DMA would get the samples in and out, but the interrupt that occurs when the DMA is full would do all of the sample processing for the block.
Great example, thank you! did you use the default pins for the STM board? could you please share the pin to pin STM/Pmod connections you used for this to work? thanks ^^
@@YetAnotherElectronicsChannel Thank you your videos and code are very helpful. I'm trying to implement your phase vocoder to do pitch shifting in a DSP project i'm working on for school. I do have a question to solve a problem I've encountered: I see that the PmodI2S2 has separate pins for the ADC and DAC side, but both need the same clock signals: MCLK, LRCK (WS), and SCLK. Did you short these pins together on the pmod board somehow or did you configure pins on the STM32F4 to give you duplicates of the clock signals ?
The ADC you used is for audio signals, because it has ainr and ainl inputs. Do you know a similar adc that can be used for single signal? Or can I just use one of the input ports of the ADC and connect the other to ground?
Audio ADCs are typically always in stereo. There also some on the market which even have 4 or 8 audio channels. But always a multiple of 2. And yes, you can keep one input floating or connect to GND via a capacitor and then process only the samples of one channel inside the DSP
Hello, thank you so much for the video. I have a question about debugging it in STM 32 IDE, It kept saying debugging connection lost? Can you tell me what kind of configuration you used for debugging it? Or maybe the way I flash it to the board wrong?
do you have any advice on Where in the code to control TIME with a pot (say time= time*(float) pot1; when i put that into the main it breaks. but without that line my adc works and sound and reverb work. so just need to figure out where it doesnt break the i2s. thanks :)
hi bro, at the schematic, i connect those stuff like your draw but it seem like WS, MCLK, SCLK cannot be connect at the same port (TT), i used i2s3 with audio jack out on board and pmod i2s as an input (i put it on slave mode), can you show how to connect it on board plz. Further more, seem like void HAL_I2SEx_TxRxCpltCallback and void HAL_I2SEx_TxRxHalfCpltCallback cannot work (i mean they dont fire even thought i fix the bug like your video). when i test HAL_I2S_Transmit_DMA to output sin wave sound it works , but HAL_I2SEx_TransmitReceive_DMA dont work (TT), hope you see my comment best regards
Take a look on my video about how to use the ARM CMSIS DSP library to implement IIR filters more professional and efficient on the STM32 th-cam.com/video/vCcALaGNlyw/w-d-xo.html
Hi !! I am doing a 2x vias Crossover (LP and BP) and the problem that I having is that I listen pulses but not "Music", any IN signal, the "Output" is a pulse. I need to use onboard ADC/DAC, is for the universtiy. Is it possible to share your mail in order to talk about that? Many thanks
Yes. You can enable DMA on both ADC and DAC, then have both triggered by hw timers. The samples will be interleaved so you need to split them. Use a DMA call back (as shown here) to process the ADC input. You will find that the filter order (number of taps), the sample rate and the max ADC clock speed are dependant on each other. For embedded systems the ADC clock speed has a max value much lower than "normal" systems. The sample rate will determine the sound quality of the output and should go no lower than 44.1KHz. Therefore, you will need to design your filter so that the order/taps achieve the required frequency response whilst not becoming too computationally expense to affect the sample rate. In other words, your ADC clock will be "maxed out" and it will be a trade off between sample rate and frequency response. As the cutoff frequency gets lower, the passband becomes narrower and it becomes increasingly difficult to create a cheap and effective filter.
@@thecrikster I am doing a 2x vias Crossover (LP and BP) and the problem that I having is that I listen pulses but not "Music", any IN signal, the "Output" is a pulse.
This video is really interesting. Thanks for sharing it. I have some problems with its implementation. rxBuf[0] is allocated to MSB of L-channel and rxBuf [1] is allocated to LSB of L-channel. LSB has to be in this format/: 0xKL00 in which K and L can be anything. But the most important thing having to be noted that the least Byte of LSB is 00. However, in my implementation based on your explanation, it is not. Another Thing I have problem with is that float out of filtering is unreasonably high. I checked filtering parameters. Everything seems OK. Could you please help me in this regards.? Many thanks
Marcel Dolnák have a look here: www.earlevel.com/main/2013/10/13/biquad-calculator-v2/ ... or if you are interested to calculate it yourself look here www.w3.org/2011/audio/audio-eq-cookbook.html
Hi, with regards to the DMA interrupt.. I have a suspicion that the TxRxHalfCpltCallback is called twice and then the TxRxCpltCallback is called twice due to both DMA streams triggering everytime. Is this possible?
I have an urgent question to me when you use 24 bit I2S Does the STM send 24 bit frame or send a 32-bit frame and the consider the least 8-bit ro be zeros ? plz respond
@@YetAnotherElectronicsChannel but when use DMA ( half word) and you use I2S_dma which take 16-bits data Does the I2S still preserve the 32-bit frame ?
Hanna Nabil DMA is working in 16 bit mode, but two 16-words behind each other are building a 32 bit word. You can cast the 16-bit pointer directly to a 32-bit pointer
@@YetAnotherElectronicsChannel you are right But Does the I2S will still send clock cycle for the least 8-bit even they are always zeros Um asking because I am using a codec with 24-bit DAC which let me choose between 24 , 32 bit I2S
Hello, i have one problem, yesterday i uploaded your code on stm32F4 Discovery and connected PMOD I2S2 and it was working as expected. Today i wanted to try new STM32 (STM32F401) i uploaded same code, i only changed clock configuration in STM32Cube nothing else, but i only heard cracking noise. I hooked up back to STM32F4 Discovery board and again cracking noise. Did i somehow destroied PMOD I2S2 ???? I checked wiring twice and it's correct. What do you think it's the ploblem?
@@S-MKim yeah code works great. why dont you make your own PMOD I2S2 ? one board costs 50€ with shipping isn't that much for one PMOD? i made my own PMOD and work well... also i could make 5 of them for the same price. Up to you... all you need is already in documentation for PMOD.
it was intencional, for demonstration porpouses he did one channel for low pass and other for high pass, to have full low pass and high pass i think one would need dedicated class D's to being filtered digitaly.. Edit: that would be if one would amplifly on a speaker, to have low-high pass on stereo i think it would be needed to add the another I2S "comunicator", if you know what i mean.
Hi, thanks for this great video. I used stm32f411ceu6 board ( stm32-base.org/boards/STM32F411CEU6-WeAct-Black-Pill-V2.0.html ) and activated i2s2 on full duplex master mode. İ2s2 Clock frequency to 96 kHz. After that i generated code but not worked. I checked İ2s2 pins with logic analyzer. O couldn't get any clock signals on the pins. Could you help me, please?
finally a 21st century blog on electronics and DSP, well done Sir.
So good, Your channel is not just 'YetAnotherElectronicsChannel' that blinks LED ! It's deep.
24:05 signal before the crossover
25:02 crossover two-way applied/
thank you so much for giving us this example it really does mean a lot of people like me that don't necessarily ingest code very well and are more of a visual and audible kind of folk.
I just reproduced your project. I used the WM8782 ADC with the same settings, it worked perfectly. The HAL complete callbak is already fixed in newer versions. Your video detailing the settings in STM32_Cube_IDE was very useful. Thank you very much for providing such educational material on this subject.
Fantastic video! Never knew I2S with DSP could perform so well at audio frequencies. Great walkthrough on how you learned and overcame some of the challenges you faced.
I2S, not I2C
@@einball Thanks for the correction.
@@diggleboy You're welcome! I didn't want to be nosy but I also couldn't let the thought that 'someone is wrong on the internet' bug me during the night! :-^)
Thanks for taking the time to go through all the STM32CubeMX parameters, and offering the code as well. It has been invaluable to getting me past the WALL of ARM stuff, and has maid it much clearer to dive in and get things working. Skoll!
This is exactly the audio signal details I needed to get my project working. Thank you for such detailed video and excellent content. Thanks
One thing worth noting, as I develop a similar project and I use this as an example, is that the callbacks with the default configuration are called twice per sample. One time they are called for Rx and one for Tx. In this example it doesn't matter as the code does the same thing twice with no consequences to data. However in my application I had counters and I would notice that they would count the double amount from what I ve seen on the analyzer. The workaround is to disable either Tx or Rx DMA interrupt so that the callbacks are called one time per half/full transfer.
Thank you. Someone else also mentioned this already. I would pin your message here in comment field..
did you just trust STM32 to finish handling each interrupt before moving to other ? or did you calculate how much time it would take to process data and compared to time it takes to fire each interrupt. I kind of got lost there. In case of FFT, where I believe you need to fill much bigger buffer (because of frequency resolution and etc) you would not process it before another RxReceived callback would be fired.
Do you have a link to your project's code?
@@giorgitsintsadze9919 What I do in that project is double buffering because I dont want to mess up with timings and disabling interrupts. So in case of FFT you can have 2 buffers of same size. One should gather data from i2s until is full. Once full you would switch to the other buffer and simultaneously calculate fft on first buffer.
@@edgeeffect nope sorry I cant share
Awesome video, can't wait for more dsp vids
Thank you so much for sharing this. It was very helpful in getting started with audio DSP!
Great video ! I understood for the first time how IIR filters can be implemented "by hand" !
Please keep these series going. It is awesome
Really a great explanation! Hope you stay in the lane of audio processing, because there is little simple to understand information out there with code examples to look at etc. Really appreciate the video! Also a little PS: im really curious about the audio enhancement algorithms / for example the harmonic generator you showed of in your first video.
I am so glad I stumbled upon this channel... Thank you for making these...
Yes!! Brilliant video. Excellent descriptions of the hardware and nice diagram of the input, filter and Z transform. Thanjks!!
This is an excellent video. I searched for audio filtering with STM32. I wasn't disappointed as this jumped right into an actual implementation using cubemx.
nice. i finally get to see an implementation of IIR from block diagram theory to DSP code. It helped answer so many questions. thanks
Many thanks for this! An excellent discussion of I2S DSP.
Nice project! I think I will test this, as well as your pitch shifter project
Hi. Great video. I've been doing a lot of work with a DAC and looking to dabble in ADC.
In your vid
at around 9:30 you said the uC can't generate exactly 96kHz.
Did you try to tune it in any further using the PLLI2S multiplier in Clock Config? (seen at ~7:50 at the bottom)
You should be able to increase or decrease the multiplier a bit to tune the error percentage in closer to the target frequency.
It usually won't pull it in exact, but it should be able to tune in to less then 1% error.
you are great Sir ....................... I hope you will make more such videos
Thanks so much for your generousity Sir
Very helpful video, thank you
Hallo, eine Frage:
am Anfang sagst du ja deine Master Ck ist 6,144MHz und deine BLCK ist 24,576 MHz. Aber in deiner Clock Configuration (7:55) hast du bei deiner I2S Clock 96 MHz eingestellt? Wie ergibt sich da der Zusammenhang? Und über welche Parameter steuert man die Bit und Master Clock?
Liebe Grüße
Du hast natürlich recht - das ist bisschen verwirrend. Mit 96 MHz wurde das I2S Modul getaktet. Eigentlich keine valide Frequenz, wenn man die Audio-Clocks exakt treffen will. Korrekterweise hätte die Clock da z.B. 98.304 oder 49.152 MHz sein müssen. Damit würde man dann durch 2^x Teiler dann entsprechend die Frequenzen wie 24.576M, 96k, 48k, 6.144M treffen. Normalerweise reserviert man für das audio-clocking eine eigene PLL, die diese "krumme" Frequenz dann erzeugt. In dem Beispiel war die reale sampling-requenz dann eher 93.75 kHz statt 96k
incredibly useful and well put together video, thanks so much
great stuff! Keep it up brother
Great video dude! Looking forward to more content.
That!!! That is amazing!!! Thank you so much for sharing this video
thank you so much, I've learned a lot from your videos. Keep up the good work !
Great video, thank you!
I'm using an STM32F767ZI, it does not have full-duplex I2S interfaces but does have multiple half-duplex ones. Instead of HAL_I2SEx_TxRxCplt(), I have HAL_I2S_TxCplt() and HAL_I2S_RxCplt(), etc. For two half-duplex I2S interfaces do I need to make sure the transmitting interface is initiated / started first? Does it matter which interface is connected to the Pmod ADC and which to DAC? Does it matter which one is in master mode and which is in slave mode?
Any pointers would help me out, thanks!
Hi! Did you ever figure that one out? I'm having that exact same issue on the F730. Thanks!
Wow, thanks so much for this!
Very good.... Waiting for the next tutor to combine with VHF transmitter
Kind regards....
Really nice job. Thank you for the video!
Great tutorial
Great video! I'm a complete newbie here. I have a couple of questions. 1. Should the Pmodi2s2 be set as master mode or slave mode? 2. Should the VCC of Pmodi2s2 be connected to 3V or 5V output of STM32F407? 3. Is the LineIn of Pmodi2s2 connected to computer and LineOut connected to a headphone? Look forward to your answer. Thanks!
you got any answer
Amazingly useful video to start!
Good
Hi, excellent project. I would ask about signal input and output to board. Are you connect signal output (from PC) direct to LINE IN on board and LINE OUT from board to microphone input on PC? I’m afraid about signals level. Could you describe how are you connect this ? Thanks.
You are great. Thank you.
Awesome!
I should try it on ESP32
Also I find your another one video with reverberation very interesting. I had experiments in my childhood with IC chips. There was TTL like RAM for delay and a opam for ADC for implementing the reverberation machine. It was device sized like shoes box. Haha.. After four of mounts assemble and fix wired issue its had been working!
gracias amigo por compartir tus conocimientos
Great video. A couple of questions if I may. I saw that the I2S_ex drivers are available for the STM32F4 but not for the F7 - any ideas why that might be? The I2S support is there in Cube for F7 but the Full duplex mode isn't supported. Also - did you capture both the half and full complete callbacks to give you and extra window of processing? I didn't quite understand that. Anyway - great series of videos, thank you !
Thanks so much! awesome video!
Thanks for your video. May I ask you the connection between the PMod I2S2 board and the STM32F407 Discovery board? I don't know where to connect the pins of the DAC of the I2S2. Thanks in advance!
very good!! Thank you, I did learn a lot! The ADC takes an Input of 0 - 3.3V. Do you use an op-amp adder with 1.5V at the ADC to allow for the AC audio input? How much CPU load does this example finally take? What is the heaviest load; the IIR filter, the int handling...?
I do have a question: did you ever compare the STM32F4 IIR filter response to the theoretical/calculated transferfunction? I find an offset of several hundert Hz and cant explain why (the true sampling freq. is lesss then 96kHz; but only 2% or so)...
Is it possible to provide a link to the researchgate information you have displayed?
thank you
Great video, I am going to use this as my introduction to DSP with a microcontroller! I was wondering what the input signal looks like? Can I use a bi-polar input or do I need to do the whole biasing thing between 0 - 3V's?
Useful project .thank you
Excellent video! Is it really necessary with the "Master Clock Output" selection? I see that there are two lines that appear to have a clock signal: I2S2_CK and I2S2_MCK. Could you tell me the difference? Another thing: Have you set the DMA buffers to byte (8 bits), half word (16 bits) or word (32 bits)?
I guess I'll answer my own question: If the I2S unit has internal PLL it would suffice to disable the master clock output and use only the I2S2_CK line as input to the SCK of the unit. I think your setup use half word for the DMA, as this was working out nicely for me.
Thank you, I learned a lot! One question: The incoming i2s data stream is 24 bit left aligned, so I would have expected to see a shift right by 8 to restore the incoming data to how the processor interprets data (right aligned).
int lSample = (int) (rxBuf[4]
I²S is transmitting the data in signed integer format (means 2's complement) with the sign-bit being transmitted directly at the beginning.
In 32-bit integer, the sign-bit is also most MSB bit.
Of course you could shift the data low by 8, but you have to care, that still the sign-bit is on the correct position for also 32-bit integer data type (means that is not just a bit-shift but an arithmetic bit-shift).
In the end it doesn't care if all the data values are scaled up by 255 or not. The risk in my implementation for sure is that you can get faster numeric overflows then if you are near to clipping level.
@@YetAnotherElectronicsChannel that makes perfect sense, can't wait to learn more from your videos !
Thank you, I will try, I would show you directly in the video how everything on the Board is tested. How much does Jack 3.5 need? There's only one on the Board, won't it be enough?
2) Is there a project implementation on SPL (LL)?
Yes there is an audio-codec on the board for audio output. However you don't have any audio input besides a microphone and you also have to configure the audio codec before with I2C. Using the PMOD I2S2 board here is quite more easier as you don't have to do software configurations first.
Good work!
Is it possible to get proper 96 kHz instead of proposed 93.75?
Great video!
Great job!
I have tried to follow along with this but am having trouble when connecting the PMOD ADC and DAC, and cannot seem to pass through audio. Do you have any recommendations or can you indicate how to wire this? I noticed the LR clock connection is not shown on your block diagram and want to know where this connection would be applied :)
I'm working on a project using STM32F411 Disco board, and it is connected via Fullduplex I2s and DMA like you described.
I have a hard time getting the samples right and having math manipulations not corrupting the output.
I'm stuck on this issue for 2 days now, and I watched your video & Phil's Lab's videos multiple times, and no matter what bitwise operation I perform on the input data, the output is getting corrupted.
Can you maybe help me via a short zoom meeting?
of chat about it privately ?
Cool info :) Is it possible that I use PCM5102 Decoder Board ?
I still hope you would reply on how to generate correct audio clock... Is this even possible with STM32F series?! More than 2.34% deviation is unusable if I say want to stream predefined sample rate stream from USB for example. In fact, any deviation would be unacceptable in this case :( .
Good video
Is it also possible to have a real time auto tune effect based on Fourier transformations. How could one go about such an idea?
Hi, Can i implement this on STM32F103C8T6 Blue Pill Development Board or STM32L100C-Discovery board?
great work
Teacher, How can I get the microphone on stm32f4 to realize some applications about Dsp. Thank you
Also what should the data width be set at for the circular mode DMA settings in STM32CubeMX? Byte? Half word? Word?
First, thanks for the great video!!! Second, does DSP library work on nucleo-L476RG?
No, since that board has no i2s, i also was researshing for that, and according on this site:stm32duinoforum.com/forum/viewtopic_f_29_t_4181.html, there's some way to make it work with i2s, but it would mean more work.
@@asunavk69 Oh but thats for the final part of the video. I just need fft and FIR lowpass filters. I tried a low pass filter and it worked perfectly. Thanks for everything and continue with the good work.
@@antoniomartos2343 idk what fft is but if a FIR low pass works for you then ok, did you do it with the l476rg?
@@asunavk69 fft means fast fourier transform for having signal in frecuency domain. FIR lowpass worked perfectly. Thanks a lot!!
is there anything special about this codec or would these videos work for example with the WM8731? thanks for this great series
dan snazelle WM8731 will also work, but will need some modification as it needs to be configured before
@@YetAnotherElectronicsChannel yes i tried to build it :) but i am now reading it needs to enabled..however i am not sure where to do this. (seems it must be enabled via i2c?) anyway excellent videos.
How can we read and copy the uploaded code from STM32F405RGT6? Please can you explain
how did you wire up your boards, because i wired them up with some jumpers and connected my headphones to the DAC. The result is that I can hear the music but I have noise.
As i don't have the exact same chip, My configuration does not end up being the same and so I just hear white noise. The callback line is not there as well as some peripheral related stuff. Help! --- Update: my setup only worked with half word for reasons I don't understand
Hi there.
Can you suggest me a ST MCU that can process 7.1 audio (8ch) through 4 stereo I²S lines, streaming it to my DAC? I'm actually working on my final eng grad project and I need to process multi channel decoded audio comming from HDMI interface. It has been so hard to research such kind of content on YT.
Nice video. Thanks!
Good work! Is (there) any way to configurate an I2S bus with LL drivers?I tried to build a project with stm32f303vct6, but there in the CubeMX ( "ProjectManager->advanced settings" ) is a one pukt next to I2S: it is HAL.
Loving these videos, very clear explanations! However, when I upload to my board the results are noisy af! Any tips? Wires leading to the DAC/ADC are short etc, not sure how you get such crisp recordings. I get some strange artefacts.
How did you distribute the clocking? What converters are u using? Did u check the I2S signals with the scope ?
@@YetAnotherElectronicsChannel hello! Just loaded up your project files and uploaded. Same boards etc as you are using in your video! Will have a scope tonight and see if it's something obvious. A fellow audio and electronics enthusiast so love your videos!
Damon McCartney what I was doing always wrong is that I exchanged sometimes the datelines from/to ADC / DAC ... and for sure the clocking signals like MCLK, SCLK und WS are only available once on STM side but need to be spreaded to both ADC and DAC. The 3.3V supply can be taken directly from the STM32 board
Hello, congratulations on your work.
what is the possibility of building a musical keyboard with stm32, how to do that. Can I play musical notes with this?grateful
How can I configure the DSP to communicate with windows via USB? So I can use a similar system as an audio interface
Nice video! I would recommend doing filter processing in the main loop though.
I certainly wouldn't.
@@robertbristow-johnson6362 aren't interrupt handlers supposed to be as fast as possible? All the heavy processing then is done in the main loop or separate task.
@@assertivebird No not necessarily. In real-time DSP, we would put all of the sample-by-sample processing in the interrupt handler. If we are processing samples in blocks, then DMA would get the samples in and out, but the interrupt that occurs when the DMA is full would do all of the sample processing for the block.
really cool, but i'm curious to know, why you need such LF HF filtration? What is for?
Leonid Sobolev there is not sense behind 1 kHz high- and lowpass. It’s just a demo
Great example, thank you!
did you use the default pins for the STM board?
could you please share the pin to pin STM/Pmod connections you used for this to work?
thanks ^^
The pinning of the STM32 you can see in the block diagram quite at the beginning of the video
@@YetAnotherElectronicsChannel oh, sorry I must have missed that detail..., thanks!
Check out roughly 3:10 for example
@@YetAnotherElectronicsChannel yep, there it is... I somehow overlooked it thinking this diagram was more conceptual 😅
@@YetAnotherElectronicsChannel Thank you your videos and code are very helpful. I'm trying to implement your phase vocoder to do pitch shifting in a DSP project i'm working on for school. I do have a question to solve a problem I've encountered:
I see that the PmodI2S2 has separate pins for the ADC and DAC side, but both need the same clock signals: MCLK, LRCK (WS), and SCLK.
Did you short these pins together on the pmod board somehow or did you configure pins on the STM32F4 to give you duplicates of the clock signals ?
The ADC you used is for audio signals, because it has ainr and ainl inputs. Do you know a similar adc that can be used for single signal? Or can I just use one of the input ports of the ADC and connect the other to ground?
Audio ADCs are typically always in stereo. There also some on the market which even have 4 or 8 audio channels. But always a multiple of 2.
And yes, you can keep one input floating or connect to GND via a capacitor and then process only the samples of one channel inside the DSP
@@YetAnotherElectronicsChannel thank you very much for the quick answer
Hello, thank you so much for the video. I have a question about debugging it in STM 32 IDE, It kept saying debugging connection lost? Can you tell me what kind of configuration you used for debugging it? Or maybe the way I flash it to the board wrong?
Did you find the answer? Is it an error?
How connect stm32 board to i2s board?
Good job
I'm trying to do what you do except with Analog Devices Blackfin BF533 for 8 channels.. can I hire you to help?
do you have any advice on Where in the code to control TIME with a pot (say time= time*(float) pot1; when i put that into the main it breaks. but without that line my adc works and sound and reverb work. so just need to figure out where it doesnt break the i2s. thanks :)
These two lines *must* be in error (assuming int is 32 bits).
int lsample = (int) (rxBuf[0]
hi bro, at the schematic, i connect those stuff like your draw but it seem like WS, MCLK, SCLK cannot be connect at the same port (TT), i used i2s3 with audio jack out on board and pmod i2s as an input (i put it on slave mode), can you show how to connect it on board plz. Further more, seem like void HAL_I2SEx_TxRxCpltCallback and void HAL_I2SEx_TxRxHalfCpltCallback cannot work (i mean they dont fire even thought i fix the bug like your video). when i test HAL_I2S_Transmit_DMA to output sin wave sound it works , but HAL_I2SEx_TransmitReceive_DMA dont work (TT), hope you see my comment
best regards
Hello, I'm looking to implement filters on a ESP32, you have experience in that platform?. Would be only 16 kHz sampling. with bandpass filters.
Take a look on my video about how to use the ARM CMSIS DSP library to implement IIR filters more professional and efficient on the STM32 th-cam.com/video/vCcALaGNlyw/w-d-xo.html
how do you know the sampling frequency is 96Khz
Hi !! I am doing a 2x vias Crossover (LP and BP) and the problem that I having is that I listen pulses but not "Music", any IN signal, the "Output" is a pulse.
I need to use onboard ADC/DAC, is for the universtiy. Is it possible to share your mail in order to talk about that? Many thanks
Would it be possible to do this using entirely the onboard STM32 ADC and DAC instead of the CS I2S modules?
Yes. You can enable DMA on both ADC and DAC, then have both triggered by hw timers. The samples will be interleaved so you need to split them. Use a DMA call back (as shown here) to process the ADC input.
You will find that the filter order (number of taps), the sample rate and the max ADC clock speed are dependant on each other. For embedded systems the ADC clock speed has a max value much lower than "normal" systems. The sample rate will determine the sound quality of the output and should go no lower than 44.1KHz. Therefore, you will need to design your filter so that the order/taps achieve the required frequency response whilst not becoming too computationally expense to affect the sample rate. In other words, your ADC clock will be "maxed out" and it will be a trade off between sample rate and frequency response. As the cutoff frequency gets lower, the passband becomes narrower and it becomes increasingly difficult to create a cheap and effective filter.
@@thecrikster Are you talking ybout the IIR filter ? How does it effect ADC clock of the internal ADC but works fine with the external?
@@thecrikster I am doing a 2x vias Crossover (LP and BP) and the problem that I having is that I listen pulses but not "Music", any IN signal, the "Output" is a pulse.
please keep posting
This video is really interesting. Thanks for sharing it. I have some problems with its implementation. rxBuf[0] is allocated to MSB of L-channel and rxBuf [1] is allocated to LSB of L-channel. LSB has to be in this format/: 0xKL00 in which K and L can be anything. But the most important thing having to be noted that the least Byte of LSB is 00. However, in my implementation based on your explanation, it is not.
Another Thing I have problem with is that float out of filtering is unreasonably high. I checked filtering parameters. Everything seems OK.
Could you please help me in this regards.?
Many thanks
Did you try to compile my project? Was this working? Which device to you exactly use?
Hi
What program do you use to calculate the IIR filter in your project ?.
Marcel Dolnák have a look here: www.earlevel.com/main/2013/10/13/biquad-calculator-v2/ ... or if you are interested to calculate it yourself look here www.w3.org/2011/audio/audio-eq-cookbook.html
@@YetAnotherElectronicsChannel Well thank you :-)
It wasn't totally clear to me, but do you know the max samplerate? Is 192kHz possible for example?
Yes, 192 kHz is possible. Just checked it in the CubeMX Software.
Hi, with regards to the DMA interrupt..
I have a suspicion that the TxRxHalfCpltCallback is called twice and then the TxRxCpltCallback is called twice due to both DMA streams triggering everytime. Is this possible?
O yes!..you found that to..:-).. I put that remark at the bug report on github
Quick fix: comment out the Dma interrupt associated with the send
What about voice?
Unfortunatelly,i dont have pdm microphone so i have to use stm32 microphone but i couldnt do that please someone help me?
I have an urgent question to me
when you use 24 bit I2S
Does the STM send 24 bit frame or send a 32-bit frame and the consider the least 8-bit ro be zeros ?
plz respond
Hanna Nabil u are right, 24 bit audio is actually transmitted in 32 bit frames. The 8 LSB are 0‘s
@@YetAnotherElectronicsChannel but when use DMA ( half word) and you use I2S_dma which take 16-bits data
Does the I2S still preserve the 32-bit frame ?
Hanna Nabil DMA is working in 16 bit mode, but two 16-words behind each other are building a 32 bit word. You can cast the 16-bit pointer directly to a 32-bit pointer
@@YetAnotherElectronicsChannel you are right
But
Does the I2S will still send clock cycle for the least 8-bit even they are always zeros
Um asking because I am using a codec with 24-bit DAC which let me choose between 24 , 32 bit I2S
Hanna Nabil yes there will be another 8 clock cycles even if it is 0‘s
Hello, i have one problem, yesterday i uploaded your code on stm32F4 Discovery and connected PMOD I2S2 and it was working as expected. Today i wanted to try new STM32 (STM32F401) i uploaded same code, i only changed clock configuration in STM32Cube nothing else, but i only heard cracking noise. I hooked up back to STM32F4 Discovery board and again cracking noise. Did i somehow destroied PMOD I2S2 ???? I checked wiring twice and it's correct. What do you think it's the ploblem?
Perhaps you could kindly make a detailed video on how you make it realized. I am still working on it for a week but no clue.
@@S-MKim I did fixed it... i was using male to female wires and ofcourse somewhere was no connection between pins. That was the reason.
@@S-MKim well i used 6x2 female header and i soldered pins to STM32F4 and worked.
@@kekecjan Congratulations. So the codes seem alright. I will buy a new Pmod I2S2 (mine seems dead) and try it again.
@@S-MKim yeah code works great. why dont you make your own PMOD I2S2 ? one board costs 50€ with shipping isn't that much for one PMOD? i made my own PMOD and work well... also i could make 5 of them for the same price. Up to you... all you need is already in documentation for PMOD.
The second sample did not sound that good, bass on one side treble the other ? That's not normal
it was intencional, for demonstration porpouses he did one channel for low pass and other for high pass, to have full low pass and high pass i think one would need dedicated class D's to being filtered digitaly..
Edit: that would be if one would amplifly on a speaker, to have low-high pass on stereo i think it would be needed to add the another I2S "comunicator", if you know what i mean.
Hi, thanks for this great video. I used stm32f411ceu6 board ( stm32-base.org/boards/STM32F411CEU6-WeAct-Black-Pill-V2.0.html ) and activated i2s2 on full duplex master mode. İ2s2 Clock frequency to 96 kHz. After that i generated code but not worked. I checked İ2s2 pins with logic analyzer. O couldn't get any clock signals on the pins. Could you help me, please?