STM32 Guide #4: Generated Code, HAL, and Bare Metal

STM32 Tutorial. This video breaks down generated code from STM32 Cube IDE / CubeMx to explain what's going on behind the scenes. I also cover the HAL documentation to explain how to create your own setup code instead of using CubeMX. Additionally, this video covers the bare-metal manipulation of the PWM duty cycle to demonstrate how you can control the microcontroller without HAL or CubeMX.

Пікірлер: 257

  • @prashkd7684
    @prashkd76843 жыл бұрын

    ST should pay you for these tutorials as none of their engineers has so far managed to explain HAL libs in such detail. Please make separate vids on different peripherals and then some example application implementation for each.

  • @MitchDavis2

    @MitchDavis2

    3 жыл бұрын

    It would be super cool if I got in touch with ST. I'd be a bit embarrassed to show them my first video in this series. It was riddled with mistakes, such as the specs for the blue pill. My channel is probably still too small at this point for them to care about any sort of sponsorship though.

  • @Sentinel-1

    @Sentinel-1

    3 жыл бұрын

    Completely agree. ST documentation sucks a lot: literally thousands of pages and nearly nothing useful (it's much faster to see a code implementation and figure it out by yourself than to read the documentation). They really should hire this guy to clarify and fix it on human-readable and usable language.

  • @km4hr

    @km4hr

    2 жыл бұрын

    It's very likely that ST has a training division that charges big bucks to attend their classes. It's a major source of revenue. At least that's the way I've seen it done at other companies.

  • @ml1557

    @ml1557

    Жыл бұрын

    So good. please continue!

  • @garrylove8955

    @garrylove8955

    Жыл бұрын

    @@km4hr in the world of automation engineering, Allen Bradley is a big culprit for that lol

  • @regal_7877
    @regal_78773 жыл бұрын

    This is slowly becoming one of the best bare metal ARM programming courses. Very few other videos/courses explain direct register manipulation and the intricacies of working with the datasheet and reference manuals. They're mostly just "yeah so the HAL is this and this and this". Thanks for this video.

  • @MitchDavis2

    @MitchDavis2

    3 жыл бұрын

    Glad to hear that! My #1 goal isn't to just tell people exactly how to do something. I want to focus more on how you would be able to find it out on your own. The answer to "how do I use PWM" shouldn't be "go look at this person's video". Instead, you should be able to learn it on your own by reading through the necessary documentation. It's a bit scary to do though if you aren't familiar with it, so I'm trying to ease into documentation reading while still being practical.

  • @stevenm3914

    @stevenm3914

    2 жыл бұрын

    @@MitchDavis2 you have successfully done that. I’m studying mechanical engineering but I can say I was definitely able to keep up with the explication. Thank you now time to use my STM for some PWM used on stepper motor.

  • @user-qh5br9jl9g

    @user-qh5br9jl9g

    8 ай бұрын

    ​@@MitchDavis2hello! Can you please give me an overall idea of the benefits of combining an mcu with a DSP? And some combo examples in real life and the jobs they do?also, this lesson applies to rip Pico's also, correct? Compare the st model you used to the pico abilities wise, please.

  • @bbbel4254
    @bbbel42543 жыл бұрын

    I wish that you continue to do a full series about stm32 .Your way is so simple and everything is clear

  • @MitchDavis2

    @MitchDavis2

    3 жыл бұрын

    That's the plan. I still have a LOT more to cover. The hardest part about these videos isn't deciding what to cover, it's deciding what NOT to cover.

  • @bbbel4254

    @bbbel4254

    3 жыл бұрын

    @@MitchDavis2 I hope that you can get a good progress .

  • @ErtugrulOzdemir-mf1gl
    @ErtugrulOzdemir-mf1gl3 жыл бұрын

    this channel deserves way more attention thanks for showing whats actually happening under the hood

  • @MitchDavis2

    @MitchDavis2

    3 жыл бұрын

    I'm glad to hear you think that. I'd love for more people to follow me, but I also don't want to turn into that stereotypical person who never stops saying "DON'T FORGET TO SMASH THAT SUBSCRIBE BUTTON". That being said, I'll certainly never be opposed to other people sharing my content if you really like it.

  • @yacineyaker7485

    @yacineyaker7485

    3 жыл бұрын

    @@MitchDavis2 continue on doing this quality vids and u'll be a big dude on ytb. love ur work

  • @icvetz

    @icvetz

    2 жыл бұрын

    @@MitchDavis2 Do it! I don't mind being asked to subscribe when the content is as good as yours. I hope that you continue to make STM32 videos, you're an excellent teacher and you are very articulate.

  • @mikeatwork7593
    @mikeatwork7593 Жыл бұрын

    Hope to see a part 5 at some point, thanks for the videos.

  • @How_Interesting.
    @How_Interesting.Ай бұрын

    Your series are hands down the best resources for beginers to learn STM32 🙌 I beg you to make more. I feel like I'm receiving enlitament whenever you explain a new concept 🙇‍♂

  • @MihaiDesigns
    @MihaiDesigns2 жыл бұрын

    Looking forward to the next part 😃

  • @shannontracy7487
    @shannontracy74873 жыл бұрын

    You're back. I'm psyched. You have a real talent for teaching.

  • @RockOfGreece
    @RockOfGreece11 ай бұрын

    pleeeeeeease more videos on stm32 you are by far the best in youtube in the matter and this series was the reason I subscribed

  • @lovrodvorski7180
    @lovrodvorski7180 Жыл бұрын

    I would love it if you kept this series going as it has helped me understand the auto generated code which is super scary when you just begin working with embedded systems and the documentation is so hard to navigate if you're new to stm32, so please keep this series alive!

  • @lenux5828

    @lenux5828

    Жыл бұрын

    yes, it is really well done and simplified

  • @darthvader4310
    @darthvader4310 Жыл бұрын

    bro I would love if you continue this series , you are like father here teaching so much in detail , respect and love ❤️❤️

  • @sudheerkp3508
    @sudheerkp3508 Жыл бұрын

    Well explained. Production is top quality. Please continue the series with ADC, I2C/SPI, etc.

  • @martos68
    @martos683 жыл бұрын

    I am from Brazil and I really like all your vídeos about STM32. The quality of your explanation and detailed information that you have added inside the video editing were fantastic. If you could launch a course about STM32 I would pay for it at the first time. You may talk about PWM output controlled by a rotary encoder, ADC showing conversion on LCD display, some kind of communication using LoRa devices or GPRS modules, etc. Starting from simple codes and re-using them to create complex codes and application.

  • @mdmonirulislam6269
    @mdmonirulislam62692 жыл бұрын

    Very straight forward video and easy to have a graps on it. Please continue this series.

  • @kadirkoyun8173
    @kadirkoyun81732 жыл бұрын

    Probably most useful video that I've ever watched on KZread. Thanks!

  • @brendanbarbour8568
    @brendanbarbour85683 жыл бұрын

    Hey Mitch, great piece of work again. I think you have a gift for explaining complex things and I can't wait for the next ep. Keep it up..please

  • @doronlola1763
    @doronlola1763 Жыл бұрын

    This is a Wonderful series Mitch! Thank-you and would love for you to continue this work

  • @pranavsrinivas4299
    @pranavsrinivas42993 жыл бұрын

    Just binge-watched this series of videos. Hoping to learn a lot more in the future :)

  • @jabbathehut9564
    @jabbathehut95642 жыл бұрын

    I really hope you do more of these. They are very well explained. You earned yourself a new subscriber!

  • @khanhlinhle6428
    @khanhlinhle64283 жыл бұрын

    Thanks for this series. Really looking forward your next video.

  • @saurabhparekh9242
    @saurabhparekh92422 жыл бұрын

    These are the best videos for STM32. Thank you so much for making this series. Eagerly waiting for the next video.

  • @thebrakshow7415
    @thebrakshow7415 Жыл бұрын

    You, sir, are an excellent instructor! This is very well laid out and clear. Looking forward to more!

  • @SzymonZakrzewski
    @SzymonZakrzewski2 жыл бұрын

    Hi Mitch, please continue this series, you are doing a great job

  • @MuratIsikHome
    @MuratIsikHome2 жыл бұрын

    Thank you Mitch for the exceptionally clear style and explanatory power. We don't see many examples of these very often.

  • @farukhannan8230
    @farukhannan82303 жыл бұрын

    Hi this is very incredible video series, you showed clarity, simplicity and a very comforting pace of of conveying complicated information. you are a extremely good teacher. i am very much a fan now and i am looking forward for the next video. Hats off !!

  • @Sentinel-1
    @Sentinel-13 жыл бұрын

    Very good code research! I definitely like your clear-cut way of thinking. 👍

  • @user-eb3mp5vc1f
    @user-eb3mp5vc1f2 жыл бұрын

    Hi Mitch, I really want to say that this series of videos is the best intro course for me to self-study those embedded system-related among all stm32 videos on youtube! As a CS student who wants to learn some chip manipulations, the most difficult part is always the setups and the wire connection issues. Really appreciate your videos and hope you could come up with more interesting videos about stm32!

  • @BechirZalila
    @BechirZalila2 жыл бұрын

    Can't wait for the next videos. Amazing work. Thank you!

  • @caleb7799
    @caleb7799 Жыл бұрын

    You are the man! I can only imagine the amount of time it take to produce these videos.

  • @Rahulhna1206
    @Rahulhna1206 Жыл бұрын

    Please keep posting these type of tutorials, These are so much helpful for the learners trying to use STM. Great!!!!

  • @alexb9143
    @alexb91432 жыл бұрын

    Man, thank you for those videos! I am learning now how to program SMT32 for my thesis and its great starter! Keep up the good work

  • @sevensolutions77
    @sevensolutions77 Жыл бұрын

    This is exactly i was looking for 😁 Thanks and keep on the good work 👍

  • @danijandiegues
    @danijandiegues3 жыл бұрын

    Once again congratulations and thank you for the great content you are really a great teacher. Very cool the way you taught how to use the datasheet. Teach how to do and study. I really hope you continue with this great job!

  • @markday3145
    @markday31453 жыл бұрын

    Loved the videos showing duty cycle, resolution, and frequency!

  • @MitchDavis2

    @MitchDavis2

    3 жыл бұрын

    Sometimes I feel like my "what we did last time" parts of the videos do a better job of explaining than the previous video itself. :/ Also, thanks again for pointing out my mistake last time

  • @ImaginaPower
    @ImaginaPower2 жыл бұрын

    You are the only ONE that I have learned a lot from by watching your videos. It´s easy to understand you and you take up and explain parts that others miss that are crucial to understanding STM32 programming. Love your videos so keep up the good work and thank you very very much indeed.

  • @edgeeffect
    @edgeeffect Жыл бұрын

    I've found CubeMX and HAL to be massive barriers to actually understanding STM32... I've just got this talk on as background whilst I'm soldering right now.... I'm going to come back and watch this properly later... This sounds like you've got a very interesting approach going on here.

  • @johnperez2374
    @johnperez23742 жыл бұрын

    This is a well put together tutorial, taking me from scratching my head to ahhhh!! I was thrown in the deep end at work, tasked to improve the functionality of the STM32based equipment. I needed something that will teach me the basics in one evening. You did it. Thank you!

  • @abpccpba
    @abpccpba Жыл бұрын

    Very enlightening Mitch. You have given me an understanding of registers. With this, I am going to try register manipulation using Forth Programing Language.

  • @frankokolie6536
    @frankokolie65362 жыл бұрын

    Mitch you are the best! Thanks for all you do keep the torch up!

  • @84411234
    @844112347 ай бұрын

    I’m impressed by the approach you took to review HAL and how to use it, great job

  • @prasoft2999
    @prasoft29993 жыл бұрын

    Super explanation. Outstanding... master stroke in explaining and demonstrating. God Bless. We need teachers like you

  • @uygarsasuke2208
    @uygarsasuke2208 Жыл бұрын

    You not only teach practical applications, but also teach us how to learn new things on our own. This is honestly amazing. You are so thorough with your explanations. I truly appreciate the effort you put into your videos. Please continue doing this 🙏 thank you!

  • @bitbanggaming204
    @bitbanggaming2042 жыл бұрын

    I an EE trying to break into the firmware scene. I have been up and down datasheets, reference manuals, and online courses to get better at this stuff using STM32. Your videos are extremely clear and gets straight to the point. I had to go through many mistakes and reading to get to acquire the same information. So thanks for your hard work on your STM32 videos!

  • @Mr_Deola
    @Mr_Deola2 жыл бұрын

    Thanks. You just answered a lot of questions. I am so used to the high level, but now I think I might find bare metal quite interesting.

  • @peterfaraday3956
    @peterfaraday39563 жыл бұрын

    Superb, just at the correct level. Keep it coming!

  • @hilacohen230
    @hilacohen2302 жыл бұрын

    Thanks! Your video made me a little more comfort with this "code forest"...Can't wait to next part :)

  • @peterdavila3045
    @peterdavila3045 Жыл бұрын

    You are definitely one of the best instructors for STM32 stuff. I see a great book from you on STM32 hardware/software in your future. 👍 Mitch, look at the number of views vs. number of subscribers. I think the fact that you have about 3 times the number of views to subscribers says two things. One, your content is deemed valuable by STM32 aficionados. Two, if you had more STM32 content, may be you would get more subscribers. Just my two cents. Keep up the great work.

  • @gr2353
    @gr23532 жыл бұрын

    Really good stuff here! Thanks very much for your clear and directly on point explanation!

  • @user-uu8gy9yq8n
    @user-uu8gy9yq8n3 жыл бұрын

    Please continue with this amazing content!

  • @VishalJN
    @VishalJN3 жыл бұрын

    Starting with stm32 microcontroller and no better person than you explained the programing well. Thank you and keep up the good work. Please continue this series as it gives me great confidence to ditch arduino IDE and use STM cube IDE. Cheers!👍

  • @ranjithshantikumar
    @ranjithshantikumar3 жыл бұрын

    Thank you very very much... , I'll never skip ads for your video so that I can support more videos like this....

  • @someonesays8022
    @someonesays80225 ай бұрын

    This is gold. Thank you. You are the best teacher I have ever seen!

  • @144_filanm.kelvin2
    @144_filanm.kelvin23 жыл бұрын

    This video helped me a lot for preparing national UAV competition, thanks a lot sir!

  • @islamsaeed-lab
    @islamsaeed-lab2 жыл бұрын

    Appreciate your efforts with simplicity that we need more of it to teach anything,keep going without look back to no. Of subscribers , There are some people in the world care and learn from your amazing work. From Egypt I thank you 👍

  • @mohamadsaeed3559
    @mohamadsaeed3559 Жыл бұрын

    this series is very useful, I hope if you can continue, please.

  • @arifmustafazade
    @arifmustafazade3 жыл бұрын

    Great series of videos! Bravissimo 👏

  • @baitongzhou3663
    @baitongzhou3663 Жыл бұрын

    More videos on stm32 plz. This channel is the best to cover embedded system basics

  • @tejalgadad4496
    @tejalgadad4496 Жыл бұрын

    Thank you so much for this amazing video!!! I wish to see you upload more videos in this series.

  • @WetPig
    @WetPig3 жыл бұрын

    Very high-quality videos, keep it up! I have a nucleo64-G474FE board (which was given to me from my university), followed the steps. Only Timer 20(TIM20) in CH2 mode had a PWM signal to an output. Thank god the box has a pin layout with the names and which pins on the board they are. I only have a multimeter but it was obvious it worked when I connected it to the desired pin and ground. I have no prior knowledge of these things except for a bit of Arduino and basic C stuff. I now have a very rough foundation as to what I'll need for my project. I need to control a stepper motor and have some sort of connection from the board to a PC, to change things on the go, I believe. I think the CubeIDE helps a lot for this. Again, thank you for the videos, they are longish but they go by with ease.

  • @praveenrai2821
    @praveenrai28213 ай бұрын

    Hey Mitch !! A big thanks for this video series. I started with Blue-Pill & STM32 tools ( NO ARDUINO ) & created a simple Voltmeter as my first usable project. Right now I am planning to try PWM & I already feel confident after watching your videos on PWM & Timers. Your videos & this series has been key enabler for me. I couldn't find such tutorials on STM32 elsewhere. Your skills & efforts are much appreciated. Further, I request you to please consider adding more tutorials to this series if possible.

  • @kooshaalf7240
    @kooshaalf7240 Жыл бұрын

    Oh boy do i enjoy your tutorials👍👍👍👍 having bought 2 packages that are supposed to teach me stuff about stm32 i thought i was a dumb person and I'll never understand stm32 but after only watcning this 5 videos i have learnt so much in so little time and im so excited to go and start reading reference manuals and hal documentations and learn and figure out everything by myself but i wish i had a teacher like you

  • @sidharthap
    @sidharthap Жыл бұрын

    Thank u for zooming in to your code, it makes following your content much easier on the screen of a mobile device

  • @MitchDavis2

    @MitchDavis2

    Жыл бұрын

    I’m glad it’s useful. I also do that as a challenge to myself. If there’s too much text on the screen, i might be trying to explain too much at once. It forces me to find ways to introduce things in bite-size chunks. Sometimes it’s not so easy to to though….

  • @bongomikey
    @bongomikey6 ай бұрын

    The best description out there. Thank you.

  • @ilaisegev8452
    @ilaisegev84523 жыл бұрын

    Woke up to see you uploaded a new video. Made my morning :)

  • @rafaelhung1812
    @rafaelhung18124 ай бұрын

    This series was great, it really helped a lot of things click in my brain for me so thank you!

  • @gouthamshiny3346
    @gouthamshiny33462 жыл бұрын

    the best video i found by far, being a power electronics enginner and trying to set up a pwm

  • @robindebreuil
    @robindebreuil3 жыл бұрын

    These are *really* excellent tutorials, kudos and thank you.

  • @sfmech
    @sfmech3 жыл бұрын

    This video is so informative. Thanks for making it. I learned something (hopefully, for a newbie in MCU) and hope to use it for work.

  • @miguelfaro6259
    @miguelfaro62592 жыл бұрын

    Great series, so thankfull for this, you're the man!

  • @JoLouisLA11
    @JoLouisLA11 Жыл бұрын

    This is the video that I was looking for. Thank you

  • @vyasneshkumarniranjan1542
    @vyasneshkumarniranjan1542 Жыл бұрын

    please upload more videos on stm 32 please this is really helpful if you can create a course than that be more helpful on udemy or any other platform please try to do so i am really enjoying the way you explain things and thanks a lot for all the content that you put lots of love from india

  • @jhanzaibkhan3795
    @jhanzaibkhan379510 ай бұрын

    Mitch! We are waiting for the next part. Itll be good of you if you continue with the course like keypad,lcd,usart and many more...and you are best tutor for embedded as far as i know..

  • @ismailhossain9495
    @ismailhossain94952 жыл бұрын

    You are so genius. Please do videos on ADC and RS232 communication to complete this basic series.

  • @williamjones9706
    @williamjones97063 жыл бұрын

    Can't wait for #5!

  • @dzikrurrohmani7073
    @dzikrurrohmani70732 жыл бұрын

    can't wait for the next video. I hope the next video will explain more about features in blue pill, such as how to use interrupt.

  • @goodwill7643
    @goodwill76433 жыл бұрын

    I was waiting for you :) Thanks!

  • @johnd5422
    @johnd54222 жыл бұрын

    This is the power of the internet and what it should be used for. 4 hours ago I stared blindly at an STM32 microcontroller and now I'm driving stepper motors with it. This is the evolution of education. Making things easier to understand and referring to similar constructs that your audience understands (referencing Arduino), making easily interpreted graphics, explaining the simplified interworking of what's actually happening and distributing it to the world (well except for North Korea). Keep creating this educational gold. See past the profit from the videos and understand that content like this can change the world. It might not be me or you but someone who watched this might someday solve one of humanities greatest problems... or develop AI that destroys humans because it knows we're the earths problem. Either way, nice work

  • @yosefgreen4187
    @yosefgreen41872 жыл бұрын

    I think I would not find the function __HAL_TIM_SET_COMPARE without you guide, thanks a lot. Your explanations are great, I think it is one of the best embedded guides I watched. some interesting points in the video: 2:22 enabling the "auto reload" is not needed 5:43 great explanation of passing argument with reference to structure 9:17 HAL TIM documentation 16:51 __HAL_TIM_SET_COMPARE() the function we are looking for 19:49 Bare Metal 21:38 TIMx->CCRx the relevant register 23:26 TIM2->CCR1 = some_new_value

  • @ruslaninst
    @ruslaninst Жыл бұрын

    can't wait for guide #5 thanks

  • @RobertJohnson-zs4om
    @RobertJohnson-zs4om2 жыл бұрын

    Mitch it was a great tutroial and i finally got it to work, my big problem wes the _ _ before the HAL and you said it but it went over my head thanks it was great and i appreciate your effort . MY next tast is to buld a switching power supply with thepwm from the bulePill bob

  • @rodionIv
    @rodionIv2 жыл бұрын

    Damn..These videos are gold...

  • @ismailhossain9495
    @ismailhossain94952 жыл бұрын

    Excellent. Please continue.

  • @FlyGamingChannel
    @FlyGamingChannel8 ай бұрын

    Great series. Wish you’d kept it up.

  • @MuhammadAlamulhuda
    @MuhammadAlamulhuda2 жыл бұрын

    Greetings Mitch! Hello, right now I'm in a middle of a project and maybe should using stm32 because one and other reason. Your video very helpful and easy to understans, i love it, very much. still waiting for the next part tho. keep it up, I'm pretty sure there are a lot of people that waiting too.. Great Work!

  • @BillFye

    @BillFye

    Жыл бұрын

    It has been a year, he's clearly alive because he liked your comment. Come back with part 5!

  • @azhanisyahputra9867

    @azhanisyahputra9867

    Жыл бұрын

    Anjir bwang, i'm rarely seen sucha indonesian person among the stm32 tutorial video. It seems like u getting struggle with it innit ? Me as well hahaha.... Stm32 is more complex to master than any other mcu. I'm a mechatronic student in poltek batam... We covered mcu intensifies since the 1st year... And yeah, i can't help myself with this mcu to get further as fast as other mcu was. Best regard buat anak undip lainnya bwang 🙌

  • @oshosanyamichael9589
    @oshosanyamichael95892 жыл бұрын

    Thanks for the videos. A viewer from Nigeria.

  • @rezakh3498
    @rezakh34982 жыл бұрын

    this is awesome. keep it up man! thanks

  • @toufikkaddourmokhtari7971
    @toufikkaddourmokhtari79713 жыл бұрын

    Well explained. Thank you and good luck.

  • @pholomotshidisi845
    @pholomotshidisi8453 ай бұрын

    You are a rockstar dude.

  • @lingyuankong7371
    @lingyuankong73712 жыл бұрын

    What a detailed video, thanks!!

  • @IBasilisvirus
    @IBasilisvirus3 жыл бұрын

    Keep it up with the good vids!!

  • @kenwallace6493
    @kenwallace64932 жыл бұрын

    One minor correction. Duty Cycle is the ratio of ON time over the Period, not the OFF time. Great stuff!

  • @AdilKhan-jp7hn
    @AdilKhan-jp7hn3 жыл бұрын

    Great teaching fun style. Very nicely done Thanks

  • @eduhernanzblanco_1588
    @eduhernanzblanco_15883 жыл бұрын

    Awesome videos!

  • @OmidAtaollahi
    @OmidAtaollahi9 ай бұрын

    very appreciated. Thanks again for your time.

  • @originalStefRid
    @originalStefRid Жыл бұрын

    really perfect curse ! you're rock

  • @kaakos9273
    @kaakos92733 жыл бұрын

    Thank you very much for this rich content

  • @soranfatah1033
    @soranfatah10332 жыл бұрын

    well done ..excellent explain

  • @teazeb
    @teazeb2 жыл бұрын

    Hey Mitch, these videos are incredible! Thanks for all of the time you've spent putting them together! Any chance we can expect this series to continue?

  • @MitchDavis2

    @MitchDavis2

    2 жыл бұрын

    Yes. For the past few months, I’ve been working with a company who will be involved in the next few videos. Filming hasn’t started, but the content is nearly complete

  • @teazeb

    @teazeb

    2 жыл бұрын

    @@MitchDavis2 that's amazing! So glad to hear it, thanks Mitch!

  • @jamesdulangon1265

    @jamesdulangon1265

    2 жыл бұрын

    @@MitchDavis2 really looking forward for this

  • @patrice9480
    @patrice94803 жыл бұрын

    amazing content !

  • @Lwyte17
    @Lwyte17 Жыл бұрын

    You rock Mitch.