This is one of the best instructions I have ever had, and I’m a 65 years old EE :-) I can imagine the amounts of time you have spent making these videos. I have played with Arduino for many years, but you are the first to teach me what REALLY goes on behind the IDE. Because of you I’ll start working with STM, and you’ve already given me a flying start. But please don’t stop now ... Again, thanks a lot !
"PWM series to be continued :) " Last upload on this series: 2 years ago :( We give you full support to continue to the series on STM32. Please continue with the amazing series. We will be waiting for the next videos...
The best beginner-friendly explanation about PWM timers. For some viewers, there might be a bit of misunderstanding. At 9:25, you're using 72 MHz as example (281 kHZ fix typo), and at 19:10, you're using 8 MHz, as shown by the 31 kHz reading on the oscilloscope."
Great video. Keep 'em coming. 20 minutes, 30 minutes, 1 hour. No problem. The explanation is what matters. Beginners coming from 8-bit AVR like me can really understand the thorough, seemingly obvious concepts that you explain. Can't wait for the next one
@@MitchDavis2 Damn. Well, it's much appreciated. And just take your time with it because it also gives us (me) time to also play around and experiment with programming the STM32. Helps me learn a lot more just in time for your next revelation. Kind of like Uni. Lol
@@MitchDavis2 hi mate how about like this??? Code: htim1.Init.Period = ((PWM_PERIOD_CYCLES) / 2); Code: sConfigOC.Pulse = (uint32_t)(((PWM_PERIOD_CYCLES) / 2) * 0.6); It will working?? So no need set pwmc setphasavoltage, because global pwm duty (pulse) already set max 60%?? Or this will set all tim for 60% sir?? Any idea?? Thank u
@@MitchDavis2 hi mate how about like this??? Code: htim1.Init.Period = ((PWM_PERIOD_CYCLES) / 2); Code: sConfigOC.Pulse = (uint32_t)(((PWM_PERIOD_CYCLES) / 2) * 0.6); It will working?? So no need set pwmc setphasavoltage, because global pwm duty (pulse) already set max 60%?? Or this will set all tim for 60% sir?? Any idea?? Thank u
Dude, seriously, you have insane talent explaining things. There are no gaps of knowledge left out, you answer every question I have as you go along. Videos of THIS high level of quality is rare!!!
I subscribed instantly after seeing you do one simple thing most of the people making tutorials on this topic don't do . . . you took the time to zoom into the code. Both literally and figuratively speaking. Videos like yours would have saved me lots of heads and time when I was starting out.
Man , usually I never leave comments on youtube , but as your channel is not yet large , I want to say this first 3 videos are best of the best . Thank you very much
Fantastic video demystifying PWM! Your explanation cut through the jargon like prescaler and pulse period, making it clear with that oscilloscope demo. Thanks, Mitch! Curious why there haven't been new videos lately. Eagerly waiting for part 2 like everyone else!
Thanks for the video series about STM32. Your explanations are really great. There is a typo in the calculation of the PWM frequency. It is actually 281250 Hz instead of 218250 Hz. Later on the scope shows the right duty cycle but at another frequency. Might be related to the clock configuration. This is a little confusing for beginners like me. But the video still helped me to get the PWM configured.
Hey I had a similar confusion with the frequency at the end being about 31kHz. What I think is he used the internal HSI(High speed clock) RC oscillator which gives you a frequency of 8MHz . So when you calculate the frequency of PWM you get 8Mhz/256 = 31kHz. hope this helps! (Note: You can get 72Mhz clock speed from the external crystal oscillator but you have to configure that in the CubeMX clock configuration)
don't know if you will read this, but after days of frustration and try and error, I finally managed to get it running on my stm board. Only thanks to you. So Thank you very much!
This series video is a great help to those who just started using STM32, as well as those who are somewhat familiar with it without being proficient; I am the latter. All tricks learnt in operating the STM32 IDE environment are so valuable that they will save you a lot of time and energy and most importantly, frustration. These tricks and insights are bridging the gap between where I am and where I want to be. I appreciated your generous sharing of knowledge which you at one point had to put in efforts to learn yourself!
6 місяців тому
I know this video is already old but I have to say I am really learning a lot from this. Thank you for taking your time to make this awesome content.
@@MitchDavis2 Thank You for these wonderful videos. So useful. Take your time. I have subbed to you, will be sure to check it out as soon as they are out :)
Really precise explanation. Didn't really leave any doubts and covered all that was needed. Hope to see more topics covered by you. Keep up the good work.
My understanding of the Auto Reload Preload is different from what you explained. By default, the timer keeps repeating. You can make it count once by enabling One Pulse Mode. The Auto Reload Preload affects when an Auto Reload Register change takes effect. If preload is enabled, it waits until the end of the current period, and the change takes effect when the counter resets. Otherwise the Auto Reload register is changed immediately, which will extend or shorten the current period. Consider if you're changing the ARR to a smaller value while the timer is running, and the counter is already larger than the new ARR value. With preload disabled, the counter would immediately reset (because the counter is greater than or equal to the ARR) and begin counting up to the new value. This means you'd have a glitch in the period, where it was neither the old period, nor the new period.
Thanks for pointing this out. I’ll spend a bit of time digging through the datasheet and doing a few tests, and if I made a mistake, I’ll call it out in the next video
Ok, I finally did my homework on this, and I definitely slipped up when reading the documentation. I've corrected this for video #4, and I'm giving you a shout out for pointing this out. Thanks again for the pointer before I went too deep in the mistake
If you'll ever make a complete tutorial on Udemy, I'll be the first buyer. You are incredible at explaining things. Many just tell: "set x to 255, y to 16 blah blah" and then you're more clueless than you started. You explain things and this is awesome because then I know the theory behind and I can start looking into it a bit more, and start messing around myself.
The Zoom keys are problematic on the PC too. You can redefine them by by going to Window / Preferences then type keys into the search box, scroll down to the bottom of the list and change the defaults. Fantastic tutorials BTW, best I have found so far.
wow, very nice tutorial with so much extra informations :), well done. Looking for part 2 of the timers and all the other suff you talked about... would be nice to see more about this nice content:)
One thing to think about - consider audible frequencies! Often times, the default PWM frequencies of many libraries and frameworks (including Arduino) fall well within audible frequency ranges, which very well could generate an audible annoying whine. Try aiming at at least 20kHz, more if you have small children, probably a lot more if you have pets. A few years ago I used an ESP8266 to make a wifi-connected MQTT-based RGB light, programmed it via the Arduino IDE and left all settings default. It really was an, admittedly quiet, but annoying whine until I fixed it.
Your videos are serious business. Thank you so much for putting this together it helps a lot. I will forward this to all my colleagues at university XD
That would be fantastic. I do appreciate when people share this. I just don’t want to turn into that stereotypical youtubers that overwhelms you with “LIKE AND SUBSCRIBE” every 2 seconds
@@MitchDavis2 Your videos are of such high quality I don't even think you need to remind people to share and subscribe XD. To people starting out with STM32 your videos are just like a pot'o'gold !!!
good tutorial he said it took 6 days thanks. he makes them more understandable i never realized how complicated the stm32 was need to see how to use the usb as input to computer
@@MitchDavis2 HI My name is Robert Johnson I am a retired electronic engineer in New Jersey. i want to use the the usb from the Stm32 and use it as a terminal for data from the microcontroller. I have not done a lot with programing I am 74 yrs old so when i broke in it was a different game than now. never learned C so I am getting up to speed slowly. I do enjoy your videos and i know how hard they are thanks for the response bob J
You don't need to set and reset the jumper wire every time you program and download the code to the microcontroller. You can leave the jumper wire as it is if you configure in the debug configuration the OpenOCD that came with the Stm32CubeIDE. It does the downloading of code to the microcontroller automatically without setting the jumper wire. Once you set it up, just click the debug button and it does its thing.
Programming without moving the jumpers requires just a little bit more setup by default, which is why I haven’t covered it yet. I have a million tips&tricks, but I’m trying not to distract from the main point of the video. I try to slip some tips in every now and then when the opportunity seems right
Great video. It is so easy to write embedded code when there is guide like you, thank you. 6 days working on a vide, wow!!! (does it worth it for you?) some bookmarks: 11:35 PWM configuration via cubeMx 17:45 starting the timer.
Hello Mitch its a very nice way of teaching i relay appreciate it. But one thing i want to correct that we don,t need to shift jumper 0 if we are using Stlink programmer. Stlink programmer sets STM32 board to programming mode automatically and at the end of programming it resets the board automatically . The 0 jumper is used when we are using UART for programming the stm32 board.
I followed along this video with my Nucleo board and tested PWM in interrupt mode. In the interrupt callback I toggled the on-board LED (ofcourse at quite a low frequency ;). I was able to verify both PWMs perfectly synchronized. Thank you. It was very helpful. I have a request. If possible could you please make a video on watchdog timers in STM32.
Glad it was helpful. I still have a lot of basics to cover before I get into stuff like watchdog timers. The video I’m working on right now is debugging + UART
This has been very helpful moving from Arduino to CubeIDE. I have a feeling your audience for these videos don't really need code examples for both dev boards though. I'm using both myself. I like your idea of showing off the difference between Arduino's HAL and ST's a lot. If you run out of those I would love some of the more advanced topics laid out like this - DMA for instance.
Brother! where's the PWM part 2???😭
Such an underrated channel.
It'll blow up. I can feel it in my waters.
This is one of the best instructions I have ever had, and I’m a 65 years old EE :-) I can imagine the amounts of time you have spent making these videos. I have played with Arduino for many years, but you are the first to teach me what REALLY goes on behind the IDE. Because of you I’ll start working with STM, and you’ve already given me a flying start. But please don’t stop now ... Again, thanks a lot !
"PWM series to be continued :) "
Last upload on this series: 2 years ago :(
We give you full support to continue to the series on STM32. Please continue with the amazing series. We will be waiting for the next videos...
The best beginner-friendly explanation about PWM timers. For some viewers, there might be a bit of misunderstanding. At 9:25, you're using 72 MHz as example (281 kHZ fix typo), and at 19:10, you're using 8 MHz, as shown by the 31 kHz reading on the oscilloscope."
Great video. Keep 'em coming. 20 minutes, 30 minutes, 1 hour. No problem. The explanation is what matters. Beginners coming from 8-bit AVR like me can really understand the thorough, seemingly obvious concepts that you explain. Can't wait for the next one
@@MitchDavis2 Damn. Well, it's much appreciated. And just take your time with it because it also gives us (me) time to also play around and experiment with programming the STM32. Helps me learn a lot more just in time for your next revelation. Kind of like Uni. Lol
Totally agree, good explainers for stm32 systems are so precious
This is fantastic Mitch, you have a real talent for explaining these concepts in a way beginners can understand.
Also, zoom zoom zoom, zoomzoomzoomzoomzoom. Zoom.
Mitch your are an oasis in the youtube/stm world! Thank you for your time. Great explanation!
Comments like these are what make it all worth it. Thanks!
@@MitchDavis2 hi mate how about like this???
Code:
htim1.Init.Period = ((PWM_PERIOD_CYCLES) / 2);
Code:
sConfigOC.Pulse = (uint32_t)(((PWM_PERIOD_CYCLES) / 2) * 0.6);
It will working?? So no need set pwmc setphasavoltage, because global pwm duty (pulse) already set max 60%??
Or this will set all tim for 60% sir??
Any idea?? Thank u
@@MitchDavis2 hi mate how about like this???
Code:
htim1.Init.Period = ((PWM_PERIOD_CYCLES) / 2);
Code:
sConfigOC.Pulse = (uint32_t)(((PWM_PERIOD_CYCLES) / 2) * 0.6);
It will working?? So no need set pwmc setphasavoltage, because global pwm duty (pulse) already set max 60%??
Or this will set all tim for 60% sir??
Any idea?? Thank u
this bro singlehandedly taught me 14 weeks of embedded class in 20 minutes lollllll
your channel is just what I needed to start with stm32
long time user of arduino here :-)
greetings from Belgium
Hello. Please continue making this series if you can. The previous ones have been super helpful. Thanks a lot for making videos :)
You can't imagine how good you are at teaching programming. I still watch your videos even though I already have the knowledge of what you teach.
Dude, seriously, you have insane talent explaining things. There are no gaps of knowledge left out, you answer every question I have as you go along. Videos of THIS high level of quality is rare!!!
Yey. Finally part 3
I subscribed instantly after seeing you do one simple thing most of the people making tutorials on this topic don't do . . . you took the time to zoom into the code. Both literally and figuratively speaking. Videos like yours would have saved me lots of heads and time when I was starting out.
The explanation is what matters. Beginners coming from 8-bit AVR like me can really understand the seemingly.🙌🙌💖
please continue this series your explaiation skills are too good.!!!
Man , usually I never leave comments on youtube , but as your channel is not yet large , I want to say this first 3 videos are best of the best . Thank you very much
Fantastic video demystifying PWM! Your explanation cut through the jargon like prescaler and pulse period, making it clear with that oscilloscope demo. Thanks, Mitch!
Curious why there haven't been new videos lately. Eagerly waiting for part 2 like everyone else!
This is an absolutely excellent introduction to STM and PWM. Thank you so much for taking your time to explain to a 62 years old geek :)
This is amazing Mitch. As a beginner in stm32, i have no word to say than thank you so much. You are really talented in explaining to others
an absolute beast, best pwm video on stm32
Best artist is the one who can simplify toughest of the concepts..... And u really are an artist
As a newbie , I am very happy to watch your videos. Good work Mitch
Thanks for the video series about STM32. Your explanations are really great. There is a typo in the calculation of the PWM frequency. It is actually 281250 Hz instead of 218250 Hz. Later on the scope shows the right duty cycle but at another frequency. Might be related to the clock configuration. This is a little confusing for beginners like me. But the video still helped me to get the PWM configured.
Hey I had a similar confusion with the frequency at the end being about 31kHz. What I think is he used the internal HSI(High speed clock) RC oscillator which gives you a frequency of 8MHz . So when you calculate the frequency of PWM you get 8Mhz/256 = 31kHz. hope this helps! (Note: You can get 72Mhz clock speed from the external crystal oscillator but you have to configure that in the CubeMX clock configuration)
This content is gold
don't know if you will read this, but after days of frustration and try and error, I finally managed to get it running on my stm board. Only thanks to you. So Thank you very much!
I read every comment. Some are just easier to respond to than others. Glad you got it working!
This series video is a great help to those who just started using STM32, as well as those who are somewhat familiar with it without being proficient; I am the latter. All tricks learnt in operating the STM32 IDE environment are so valuable that they will save you a lot of time and energy and most importantly, frustration. These tricks and insights are bridging the gap between where I am and where I want to be. I appreciated your generous sharing of knowledge which you at one point had to put in efforts to learn yourself!
I know this video is already old but I have to say I am really learning a lot from this. Thank you for taking your time to make this awesome content.
never clicked subscribe button so fast
Wow, this is amazing, this is exactly what I needed coming from Arduino. Please keep up the great job!
Great series, you should definitely keep continuing these and cover all embedded software/firmware concepts. Love it
I’m 4 days into filming video #4 right now. I really wish they didn’t take so long to make
@@MitchDavis2 Thank You for these wonderful videos. So useful. Take your time. I have subbed to you, will be sure to check it out as soon as they are out :)
i love this, OMG, spectacular content, easy to understand than others tutorials
LOL I saw a cat.... btw: Thank you for continuing this series.
@@MitchDavis2 its a shame the cat was so camera shy
wow, last 2 parts were good but this one is really impressive! I think your channel deserves more subscribers!
Really precise explanation. Didn't really leave any doubts and covered all that was needed. Hope to see more topics covered by you. Keep up the good work.
My understanding of the Auto Reload Preload is different from what you explained. By default, the timer keeps repeating. You can make it count once by enabling One Pulse Mode. The Auto Reload Preload affects when an Auto Reload Register change takes effect. If preload is enabled, it waits until the end of the current period, and the change takes effect when the counter resets. Otherwise the Auto Reload register is changed immediately, which will extend or shorten the current period.
Consider if you're changing the ARR to a smaller value while the timer is running, and the counter is already larger than the new ARR value. With preload disabled, the counter would immediately reset (because the counter is greater than or equal to the ARR) and begin counting up to the new value. This means you'd have a glitch in the period, where it was neither the old period, nor the new period.
Thanks for pointing this out. I’ll spend a bit of time digging through the datasheet and doing a few tests, and if I made a mistake, I’ll call it out in the next video
Ok, I finally did my homework on this, and I definitely slipped up when reading the documentation. I've corrected this for video #4, and I'm giving you a shout out for pointing this out. Thanks again for the pointer before I went too deep in the mistake
The best explanation for duty cycle i have ever heard bro nice one
Your explanations feel like a friend is teaching me. really appreciate that!
Great job again Mitch...looking forward to the Nucleo implementation. That was one scared cat ..!!
Thanks for posting these. They are very helpful and easy to follow
Thanks again for the video Mitch!
If you'll ever make a complete tutorial on Udemy, I'll be the first buyer. You are incredible at explaining things. Many just tell: "set x to 255, y to 16 blah blah" and then you're more clueless than you started. You explain things and this is awesome because then I know the theory behind and I can start looking into it a bit more, and start messing around myself.
great stuff who's been a around basic Arduino. Just perfect content on a little more low level, but not too much
i love your videos, some good informations, super clear explanations, no useless words, just wow
The Zoom keys are problematic on the PC too. You can redefine them by by going to Window / Preferences then type keys into the search box, scroll down to the bottom of the list and change the defaults. Fantastic tutorials BTW, best I have found so far.
That’s good to know. I’ll have to go play around with that. Thanks!
Your videos are awesome.. explaining perfectly man😎.. thanks for the precious time you spent on to educate us...👍
wow, very nice tutorial with so much extra informations :), well done. Looking for part 2 of the timers and all the other suff you talked about... would be nice to see more about this nice content:)
One thing to think about - consider audible frequencies! Often times, the default PWM frequencies of many libraries and frameworks (including Arduino) fall well within audible frequency ranges, which very well could generate an audible annoying whine.
Try aiming at at least 20kHz, more if you have small children, probably a lot more if you have pets.
A few years ago I used an ESP8266 to make a wifi-connected MQTT-based RGB light, programmed it via the Arduino IDE and left all settings default. It really was an, admittedly quiet, but annoying whine until I fixed it.
I don't think I've ever had an LED make audible noise, but I certainly have had a switching voltage regulator make sound.
Bro this is actually the best video on stm 32 I saw big thanks man keep on the good work 👌🏾👌🏾❤️❤️
Your videos are serious business. Thank you so much for putting this together it helps a lot. I will forward this to all my colleagues at university XD
That would be fantastic. I do appreciate when people share this. I just don’t want to turn into that stereotypical youtubers that overwhelms you with “LIKE AND SUBSCRIBE” every 2 seconds
@@MitchDavis2 Your videos are of such high quality I don't even think you need to remind people to share and subscribe XD. To people starting out with STM32 your videos are just like a pot'o'gold !!!
Great video man!!
Where is the part 2 of PWM?
Pretty easy to understand, since I'm not real programmer, because it's really amazing explanation!! Thank You, MitchLED 😅
You're the man Mitch Davis!
This a superb first class explanations of things I’ve been trying to understand. Really really great.
Hey Mitch, I cannot believe thsi is free, well i hope it isnt actually for you but this was an incredible tutorial. Thank you
Loved it !! ❤ from India !!
another excellent video. perfect actually, including the cat at the end. please keep it coming.
Thanks Mitch, and great job again!! Congrats!! Pls continue this series. PS.: Like the "post credit scene".
Hi man, I hope you are doing ok. You have really helped me a lot in learning to start programming the STM32 microcontrollers.
good tutorial he said it took 6 days thanks. he makes them more understandable i never realized how complicated
the stm32 was need to see how to use the usb as input to computer
What are you trying to do with USB input? Debug? Graph data? Control the computer?
@@MitchDavis2 HI My name is Robert Johnson I am a retired electronic engineer in New Jersey. i want to use the the usb from the Stm32 and use it as a terminal for data from the microcontroller. I have not done a lot with programing I am 74 yrs old so when i broke in it was a different game than now. never learned C so I am getting up to speed slowly. I do enjoy your videos and i know how hard they are thanks for the response bob J
Really nice video. I hope your channel will get more attention
Keep posting about STM32 Tutorials. you are doing great
Your videos are great, thank you for all the time you put into them!
Poor cat just wanted to learn some STM32 programming
Hah i don't know why the cat was running so weirdly
Best video on pwm&stm aaah tysm 🤌👏
We need more videos like this!
Great videos relly, hope you complete this series
great explanation man I really like it
it removed some confusion I had about PWM
Thanks for the tutorials Mitch! You explain very well. Keep them coming!
You don't need to set and reset the jumper wire every time you program and download the code to the microcontroller. You can leave the jumper wire as it is if you configure in the debug configuration the OpenOCD that came with the Stm32CubeIDE. It does the downloading of code to the microcontroller automatically without setting the jumper wire. Once you set it up, just click the debug button and it does its thing.
Programming without moving the jumpers requires just a little bit more setup by default, which is why I haven’t covered it yet. I have a million tips&tricks, but I’m trying not to distract from the main point of the video. I try to slip some tips in every now and then when the opportunity seems right
@@MitchDavis2 Good point. Gotcha.
Courage and thank for for the free education
Great video, well explained and presented. Looking forward to more videos. Thank you for your efforts to put this together
That cat was hilarious , Great video as always
Thanks you Mitch Davis! Well explained.
Dude you were made a fantastic work up here.
Thank you Davis. This really saved my day!
Your videos are the best man...
Such a amazing explanation.... Mann you deserve more view nd subs.. love you...nd thanks❤️
Good information comes only from good understanding
Great video. It is so easy to write embedded code when there is guide like you, thank you.
6 days working on a vide, wow!!! (does it worth it for you?)
some bookmarks:
11:35 PWM configuration via cubeMx
17:45 starting the timer.
These videos are great and extremely helpful. Thanks for sharing such informative videos, please continue :)
it was best video on pwm
Thank you sir
Please continue this series 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
Awesome video Mitch! Thank you so much :)
Hello Mitch its a very nice way of teaching i relay appreciate it. But one thing i want to correct that we don,t need to shift jumper 0 if we are using Stlink programmer. Stlink programmer sets STM32 board to programming mode automatically and at the end of programming it resets the board automatically . The 0 jumper is used when we are using UART for programming the stm32 board.
Great Video! it would be cool to see a SPI demo
Awesome Video Man. Keep the good work up.
You're a great teacher. Thank you.
I followed along this video with my Nucleo board and tested PWM in interrupt mode. In the interrupt callback I toggled the on-board LED (ofcourse at quite a low frequency ;). I was able to verify both PWMs perfectly synchronized. Thank you. It was very helpful. I have a request. If possible could you please make a video on watchdog timers in STM32.
Glad it was helpful. I still have a lot of basics to cover before I get into stuff like watchdog timers.
The video I’m working on right now is debugging + UART
Thanks, would like to see interrupt & multiprocessing demo
amazing work Mitch
This has been very helpful moving from Arduino to CubeIDE. I have a feeling your audience for these videos don't really need code examples for both dev boards though. I'm using both myself.
I like your idea of showing off the difference between Arduino's HAL and ST's a lot.
If you run out of those I would love some of the more advanced topics laid out like this - DMA for instance.
Love it 🥰 form Sri Lanka . . .
Hi Mitch Thanks for the video, Can you explain/Make a video on how can we read from a sensor that generates a PWM Signal ?
Excellent video series. Thanks
Good explained, thanks :)
So much knowledge 🥰 thank you so much
great tutorial, please keep updating.
Great video! when would you be uploading guide # 4?
I’ve been filming the past 3 weekends. Hoping to finish it this weekend