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

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

Mitch Davis

3 года назад

77,956 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Travis
Travis - 19.09.2023 17:50

I had a co worker say our stm32 could be flashed via usb instead of Jtag if we made added the feature in the bootloader. I wish there was a tutorial on that. We had a custom pcb

Ответить
Jhanzaib Khan
Jhanzaib Khan - 02.09.2023 01:06

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..

Ответить
mike jones
mike jones - 23.08.2023 03:58

woah yeah i spent the last 2 days trying to wrap my head around this pwm thing and finally got it working, was able to set the duty and even frequenc, but not sure i really understand it. And im using a stm32 clone ch32 , so no convenient HAL functions but still the same things i suppose, and you could use stm32's HAL , the chip its apparantly a drop in replacement with the same pins and registers so i think you could make those functions work as well. But i found their (wch company) documentation (only 313 pages) on ch32f103 to be enough, just barely and only with with chatgtps help, it added some verbs and what not to the dense text to make it more understandable. And it does tell you everything you need although not so easily. I think an understanding how the CPU works phsyically would give a better intuitive understanding to these calls why theyre being call in that order. Like if you knew what was going on electroincally, and maybe thats the problem im having understanding all this, as low level at it is, its still not low enough. Which even chatgtp had trouble going without some coaxing. Finally got it down to a flip flop detecting edge rise or fall and sending a signal in response, which starts the tim counter which then keeps checking the aar register to know when to stop and goes high when it does, then it counts until it reaches the ccr register, to know when to go back low. Or something like that, there was a good video explaining the process i cant find, but was very helpful understanding whats going on from a flow perspective , the phsyical chain of evens, which made the function calls and register names like AAR make more sense. In short a better understanding of the inner workins of the processer would definatley help with this jungle of code. But at the same time the capture / compare module is a complicate circuit in and of itself, so how deep do you want to/need to go in understanding. I just wanted to blink some LED's.

At a fundament level it seems wer'e just starting counters and stoping them according to some logic that sets of other clock driven counters and the idea of pwm is just exploiting these basic functions of a cpu and their little modules. With that im mind you could even implement your own pwm method and theres others apaprently that use intereupts, so different approaches, you could possibly even make your own understanding the inner workings of the cpu you're deailng with and maybe get a better idea even how to design a cpu from scratch, you could tailor one to fit the needs of your coding style instead of coding around a generic calculator. Now youre a cpu engineer! Thats how far this rabbit hole goes... or quicksand, however you want to look at it.

Ответить
TEJAL GADAD
TEJAL GADAD - 29.06.2023 06:43

I am not sure if I missed the explanation but why did Mitch not use Timer1 for PWM generation instead used Timer2 ?

Ответить
TEJAL GADAD
TEJAL GADAD - 29.06.2023 06:31

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

Ответить
kesara malinda
kesara malinda - 08.06.2023 19:27

Ok, but there is no function called as _HAL_TIM_SET_COMPARE nor any functions starting with _HAL when Ctrl+Space .Is anyone encountering the same problem?

Ответить
Jordan Rathbone
Jordan Rathbone - 30.05.2023 21:38

Hey Mitch, ST came out with a plug in for using VS Code as an IDE for the SMT32 and I was wondering if you could do a quick video on it. I am pretty familiar with VSCode but I am not familiar with STM32 all that much, just your tutorials so far and I would love to get to use VSCode to program them. Thanks!

Ответить
stef ri
stef ri - 14.05.2023 18:33

really perfect curse ! you're rock

Ответить
God's Only Monster
God's Only Monster - 30.04.2023 14:29

Pls continue this series

Ответить
CHARAN S N
CHARAN S N - 12.04.2023 16:46

please continue this series

Ответить
Koosha Alf
Koosha Alf - 08.04.2023 22:46

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

Ответить
Caleb
Caleb - 02.04.2023 06:36

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

Ответить
Mohamad Saeed
Mohamad Saeed - 27.03.2023 16:21

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

Ответить
JoLouisLA11
JoLouisLA11 - 26.03.2023 20:39

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

Ответить
Doron Lola
Doron Lola - 22.03.2023 14:34

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

Ответить
uygar sasuke
uygar sasuke - 16.03.2023 03:48

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!

Ответить
fixfaxerify
fixfaxerify - 17.02.2023 01:40

"General purpose timer cookbook", AN4776

Ответить
Rahul Vishwakarma
Rahul Vishwakarma - 10.02.2023 15:29

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

Ответить
Peter Corbett
Peter Corbett - 05.02.2023 23:20

Just watched your videos, thank you for compiling this very helpful wealth of knowledge! I don't think you ever did mention why it might be a bad idea using TIM1 for PWM. I was googling around, and haven't come up with an answer on my own, except that it might be busy when using FreeRTOS. Is that it, or am I missing something?

Ответить
Darth Vader
Darth Vader - 01.02.2023 21:28

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

Ответить
Ruslan Rasyid
Ruslan Rasyid - 11.01.2023 13:35

can't wait for guide #5 thanks

Ответить
Lovro Dvorski
Lovro Dvorski - 08.01.2023 10:40

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!

Ответить
Warren Furst
Warren Furst - 26.12.2022 19:04

What happened to part #5 Mitch?
Really enjoyed these. Well explained to a noob like myself...

Ответить
baitong zhou
baitong zhou - 23.12.2022 09:06

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

Ответить
Peter Davila
Peter Davila - 22.12.2022 19:02

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.

Ответить
Thebrakshow
Thebrakshow - 17.12.2022 16:36

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

Ответить
Er. manoj kumar
Er. manoj kumar - 12.12.2022 21:19

Nice sir thanks a lot for such educational video , make videos for 3phase pwm

Ответить
vyasnesh kumar niranjan
vyasnesh kumar niranjan - 08.12.2022 15:28

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

Ответить
Michal Romanski
Michal Romanski - 06.12.2022 16:33

Mitch, I propose to go one step forward and introduce ASM insertions? Unfortunately the IDE do not support bare assembly language like Atmel Studio does, so maybe writing ASM interrupt handlers can be a good tradeoff - in terms of perfirmance?

Ответить
Mike AtWork
Mike AtWork - 01.11.2022 15:43

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

Ответить
edgeeffect
edgeeffect - 29.10.2022 19:17

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.

Ответить
Sid Harth
Sid Harth - 19.10.2022 21:55

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

Ответить
Lonely Mechanic
Lonely Mechanic - 10.09.2022 08:51

still waiting for part 5.

Ответить
usman haider
usman haider - 06.09.2022 00:07

what is diffrencce between direct register accessing vs hal.instance??
for example:
SPI2->SR; //direct register accessing
hspi2.Instance->SR; // hal.instance register accessing

Ответить
Ajay Kumar
Ajay Kumar - 05.09.2022 11:02

Hi sir...Can you generate PWM signal using STM32WLE5JC Microcontroller sir

Ответить
Paul C Johnson
Paul C Johnson - 05.09.2022 07:00

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

Ответить
sevensolutions
sevensolutions - 31.08.2022 00:00

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

Ответить
Lagrangian
Lagrangian - 25.08.2022 10:45

You rock Mitch.

Ответить
The Goddess Geek
The Goddess Geek - 23.08.2022 12:32

Where can we get the Hal library? to use it in embedded programming. I'm having a hard time finding ways to code K64F with HAL. I don't know where to start.

Ответить
Sudheer KP
Sudheer KP - 21.08.2022 14:24

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

Ответить
G lewiss66
G lewiss66 - 12.08.2022 16:27

Hello Mitch,
Do you plan to continue this series of STM32 Tutorial? ADC, USB ... It appears to be the best I've ever watched!!! Maybe not anymore time for that. Wish you the best :)

Ответить
Happy Macer Personal
Happy Macer Personal - 02.08.2022 16:48

Thankyou for the time you take to produce the videos - been really helpful for me to get into the STM32 following some work on bare-metal on PIC16F690 and ATMEGA328p. One question though, if I dont use cubeIDE to prepare the C main file, then where do I get the HAL include file that defines the say, special function registers. I went hunting and eventually found a variety of STM32F103xb.h files in an obscure directory thats part of the CubeIDE installation. They come in a variety of apparently revisions - how do I choose? They all look the same but each is larger then the previous?

Ответить
reza kh
reza kh - 27.07.2022 15:15

this is awesome. keep it up man!
thanks

Ответить
John Perez
John Perez - 26.07.2022 11:05

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!

Ответить
Soran fatah
Soran fatah - 21.07.2022 19:04

well done ..excellent explain

Ответить
Muhammad Alamulhuda
Muhammad Alamulhuda - 10.07.2022 20:17

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!

Ответить