Starting with STM32 - Programming Tutorial for Beginners | Step by Step | Greidi Ajalik

Sdílet
Vložit
  • čas přidán 25. 06. 2024
  • For everyone who would like to learn how to start with STM32 programming. Thank you very much Greidi Ajalik
    Links:
    - Greidi's CZcams: • How To Become An Embed...
    Chapters:
    00:00 What is this video about
    01:17 Starting a new project in STM32 CubeIDE
    10:30 STM32 chip configuration - GPIO pins ( ioc file )
    16:38 Clock configuration
    22:12 Project tree and files explained
    26:53 Controlling a GPIO in STM32
    36:22 Delay function - HAL_Delay
    40:04 ST-LINK upgrade
    43:22 STLINK STM32 debugger / programmer
    45:55 Building and running your code
    49:20 STM32 interrupt code example + explanation
    1:01:53 STM32 UART to PC example + explanation
    ------------------------------------------------------
    Would you like to support me? It's simple:
    - Sign up for online courses hosted on our platform: marketplace.fedevel.education/
    - Sign up for my Hardware design and PCB Layout online courses: academy.fedevel.com/
    - You can also support me through Patreon: / robertferanec
    - Or sign up for my Udemy course: www.udemy.com/learn-to-design...
    It is much appreciated. Thank you,
    - Robert

Komentáře • 178

  • @____________________________.x

    When guests cover every little detail it’s really useful, everyone else just assumes that we already know the 42 mouse clicks they did to get from A to B

  • @Sid-po5yt
    @Sid-po5yt Před rokem +51

    We need a second part for this! Hands down one of the best beginner tutorials out there. Thank you for the effort Robert!

  • @GreidiAjalik
    @GreidiAjalik Před rokem +66

    What a great video! It was pleasure to collaborate with you and thank you so much for having me on your channel!

    • @RobertFeranec
      @RobertFeranec  Před rokem +7

      Thank you very much Greidi for helping me with this video.

    • @vincei4252
      @vincei4252 Před rokem +2

      Thanks for participating. Very much appreciated!

    • @TheProlificScribbler
      @TheProlificScribbler Před rokem +1

      I am working as an intern in one company and i was assigned task with stm32. Although even after going through documnetations i was unable to figure out the concepts. Then luckily i found this wonderful tutorial. It was very very useful and informative.
      Thanks a lot @greidi Ajalik and @robert feranec for bringing out this video. I would like to tune up for more such videos related to stm32.

  • @marc_montalvez
    @marc_montalvez Před 6 dny

    I think this is the best tutorial that I have seen in my life

  • @stevenbroshar7948
    @stevenbroshar7948 Před 5 měsíci

    I applaud the questions from Robert. You asked several questions that I was wondering about. The presenter knows this stuff so well that he doesn't know what a novice doesn't know.

  • @hernameplz6506
    @hernameplz6506 Před rokem +2

    This is absolutely amazing! Walk us through each step! Pls do more like this! Thanks

  • @nikosant03
    @nikosant03 Před rokem +16

    What a great tutorial for beginners!!! Thank again for your effort and your time!! Please upload more STM32 firmware-based tutorials explring maybe more peripherals or low-power design techniques (I liked the point mentioning the value of suspend and resume tick) :)

  • @elecrain
    @elecrain Před 10 měsíci +2

    Perfect content for learning the stm32. Thanks for the detailed explanations, we are waiting for second part !!

  • @ediahmadfauziserbhaneka9946

    Dude, this is the only video that works. Thanks for posting!

  • @johnpark3138
    @johnpark3138 Před 8 měsíci

    This is an excellent tutorial for learning about programming microcontrollers. Thanks you Robert!

  • @therealb888
    @therealb888 Před rokem +1

    Your videos are always such a high quality resource of knowledge!

  • @rahuls7039
    @rahuls7039 Před rokem +14

    Robert is like that intelligent kid who knows it all and is just helping the teacher convey every piece of information to all the kids... This is an excellent video for explaining every step...
    Thank You @Robert Feranec and @Greidi Ajalik for this beautiful video. 😇

    • @redmist4963
      @redmist4963 Před 11 měsíci

      For real, he knows all the necessary questions to make

  • @achrafeleuch3040
    @achrafeleuch3040 Před rokem +1

    very very helpful and comfortable to watch, it feels like we are with you in the conversation and it's making us concentrate a lot better :D thanks a lot

  • @lucienrapilly6407
    @lucienrapilly6407 Před rokem +2

    Thanks guys! Part 2 anytime? It would be awesome!

  • @ThePing98
    @ThePing98 Před rokem

    happy to see some software stuff in your channel , thank you

  • @kbgaminghd7504
    @kbgaminghd7504 Před 14 dny

    The amount of respect i have for this guy

  • @bartek153
    @bartek153 Před rokem

    That was very useful Robert. thanks for that!

  • @vrjb100
    @vrjb100 Před rokem +5

    Compilers will optimize code generated and remove dead code from include files etc. So it's correct to include the string.h file. Only the call to strlen will be included, because that one is really called. Include files define prototype of functions, so the compiler can do type checking and thus detect programming errors at compile time.

  • @nomadic_rider42
    @nomadic_rider42 Před rokem +4

    An Interrup can to two things: cause software to execute via an interrupt handler (if the interrupt is enabled) and cause some peripheral to do something (like triggering a timer). An Event doesn't cause the interrupt handler to run, but can cause some peripheral to do something.

  • @nambot
    @nambot Před rokem

    Cool! very useful video for getting started with nucleo board. Thanks for making this video

  • @rogerhusarik
    @rogerhusarik Před rokem +8

    Examples can be found in the repository - C:\Users\YourUserName\STM32Cube\Repository\STM32Cube_FW_G4_V1.4.0\Projects\NUCLEO-G431KB\Examples\GPIO\GPIO_IOToggle

  • @nikhilchitroda9886
    @nikhilchitroda9886 Před rokem

    waiting for more such video playlist.
    thanks !

  • @davidjablonski3996
    @davidjablonski3996 Před rokem +1

    Great video. Especially your humility with things you don't know about is outstanding and rare these days! Maybe some video on a modern RTOS like Zephyr OS as a follow-up?

  • @Fubar12341
    @Fubar12341 Před rokem

    Thank you Guys, as a slow old duffer I really found this tutorial Very Useful.

  • @therealdorsch
    @therealdorsch Před 8 měsíci +1

    Great Video! Thanks for the good explanations and details :)

  • @sandrainthesky1011
    @sandrainthesky1011 Před rokem

    Well done! This was very valuable for first time Cube IDE users (like me)

  • @felixfigueroa
    @felixfigueroa Před rokem

    Wow, what good news this initiative .... excellent way to start and masterful introduction..god job 👌

  • @skateboardinglatvia
    @skateboardinglatvia Před rokem +61

    The hardest part of STM32 programming is getting the STM32 you want

    • @matt_313
      @matt_313 Před rokem +7

      I'll never forget in 2019 when DigiKey had nearly every STM32 ic in stock by the thousands. It seemed so normal.

    • @JosefKopal
      @JosefKopal Před rokem +2

      More like get any STM in these days ......

    • @thenextproblem8001
      @thenextproblem8001 Před rokem +1

      Have literally 850pcs with wrong order. İf you interested i can share it with you

    • @JosefKopal
      @JosefKopal Před rokem

      @@thenextproblem8001 which one please ? (part number)

    • @thenextproblem8001
      @thenextproblem8001 Před rokem

      @@JosefKopal stm32l011k4

  • @user-eh5cl3cc4b
    @user-eh5cl3cc4b Před 10 měsíci

    Thank you for the explanation. Really great video for beginners

  • @mitjakobler
    @mitjakobler Před rokem

    From today, after 10 year design hardware(AD13-AD22), i will start software for my DIY project. Thanks for video. ;)

  • @payloh_3328
    @payloh_3328 Před rokem

    THANK YOU I needed this

  • @TongweiZhang
    @TongweiZhang Před 29 dny

    Amazing video, thank you!!! I am a beginner and i find this video really helpful!

  • @Frisky0563
    @Frisky0563 Před rokem

    I learn so many from you both great to see G

  • @ValiRossi
    @ValiRossi Před rokem

    Fantastic video. Thanks!

  • @arneweber7875
    @arneweber7875 Před 8 měsíci

    Thanx a lot, the tip at 40:42 to update ST-Link solved my Problem

  • @mehmetacar5881
    @mehmetacar5881 Před rokem

    It's perfect Tutorial. Thanks A lot.

  • @imrichmorvay2227
    @imrichmorvay2227 Před rokem

    Robert excelent video!!! Len tak dalej.

  • @welldonehuang9133
    @welldonehuang9133 Před rokem

    thanks for your guidance, very useful.

  • @byatse3013
    @byatse3013 Před rokem

    yes yes it is really useful thank you from Mongolia

  • @TheMechatronicEngineer
    @TheMechatronicEngineer Před rokem +1

    Great idea! You should make a whole course about this topic :)

  • @zaferaltun
    @zaferaltun Před 6 měsíci

    So helpful, thank you for your effort.

  • @Fixaj
    @Fixaj Před rokem

    thanks too much, like Matrix movie I have learned STM32 now.

  • @ahmetbingol2966
    @ahmetbingol2966 Před 6 měsíci

    Thanks for the great content !

  • @patrickrichard6556
    @patrickrichard6556 Před rokem

    good work king, love you

  • @ric_nhut
    @ric_nhut Před 8 měsíci

    I will give you a bunch of thanks for this video

  • @yabool2001
    @yabool2001 Před rokem +1

    Super! Waiting for UART receiving part.

  • @ediahmadfauziserbhaneka9946

    It worked. Thanks a lot

  • @justadude8716
    @justadude8716 Před 7 měsíci

    This is a really deep step by step for beginners, I'd argue this is something you should watch only after you stumble through the blink LED and read pin projects.

    • @spaidory874
      @spaidory874 Před 7 měsíci

      I found it fine tbh

    • @karm00n29
      @karm00n29 Před 5 měsíci

      i am depressed i dont get 80% of what theyre talking about lmao im new i only did arduino starter projects in which the code was nowhere near as complicated

  • @ge440
    @ge440 Před 5 měsíci

    Very nice video, we need second part.

  • @vincei4252
    @vincei4252 Před rokem +7

    @Robert you're a mind reader!
    Very cool. I just bought an STM32H745 discovery board. I installed CubeIDE but the initial complexity of what you need to do next when you start is stopped me in my tracks. I understand the complexity because of all the different (hundreds?) of STM32 variants but it still leaves you with initial sticker shock.

  • @ibrahimshasirajithin9150

    Very Useful....

  • @kaihorstmann2783
    @kaihorstmann2783 Před rokem +4

    You can use the built-in ST-Link for custom boards. The debug pins are available on header pins on the ST-Link of the Nucleo board. Here you need to disconnect the Nucleo MCU from the debugger.
    The purpose for the cuts in the Nucleo PCB is actually breaking or cutting off the ST-Link part from the Nucleo, and keep using the ST-Link as stand-alone device.

  • @user-ne6gm2ub5e
    @user-ne6gm2ub5e Před rokem +1

    The best channel about programming stm32 is NR.electronics.

  • @aitorsierra
    @aitorsierra Před rokem +4

    @Robert Feranec: Do you intend to make a video explaining how to design drivers (sensors) I2C, SPI using STM32?

  • @tedina72
    @tedina72 Před rokem

    Best Author

  • @Hamza_mrc
    @Hamza_mrc Před rokem

    i love it !

  • @pochuanpeng1729
    @pochuanpeng1729 Před 6 měsíci

    Very helpful, thanks. Please consider have 2nd episode step by step instructions to use I2C ( or multiple I2Cs) on STM32.

  • @frevanneste7595
    @frevanneste7595 Před rokem

    very usefull video!

  • @superdau
    @superdau Před rokem +3

    *You can use the programmer part of a nucleo board to program other STMs on other boards (including your own custom one).* The SWD interface is available on pins and there are jumpers there as well to "disconnect" the main MCU. If you want you can even cut off the programmer part. There's a prerouted slot and only three small tabs connecting the two boards. Score them with a knife and break it apart.
    Both parts will still work, but you'll obviously have to manage the connections to the programming interface of the main MCU yourself, as well as the rest like connection to power, the right UART pins, the external oscillator aso.
    The original "ST links" are already exceptionally cheap for a programmer (props to ST for that). But you can have even cheaper ones (~3€) on your favorite ecommerce platform for cheap stuff ;) . I wouldn't start out with those, to avoid problems (though I never had any, but just to be safe). They even update through the same firmware flasher tool. But be aware that the more recent ones don't use an STM32F1 anymore but a GD32F1. That's a Chinese version of an STM32 with a few slight differences. So unless the firmware for the programmer hits one of these differences the GD32F1 should be fine.

    • @desaoaraujo
      @desaoaraujo Před rokem +1

      The bootleg programmers from China are not working anymore with ST software - they detect the fake chips and won't let you use it properly.

  • @bassome3000ify
    @bassome3000ify Před rokem

    Cool, thx

  • @ovikchoudhury5957
    @ovikchoudhury5957 Před rokem

    Life Saverrr

  • @ds-dronebike
    @ds-dronebike Před rokem +2

    Absolute perfect. I start with STM32 dome months ago, like transfer from pic32 platform. Will you create any tutorial about SAI or I2S and DSP? I’m interested of sound applications with using STM32H7 and DSP instructions.

  • @jalilbiad8656
    @jalilbiad8656 Před 8 měsíci +1

    Second Part is needed !

  • @bobdalah8374
    @bobdalah8374 Před 9 měsíci

    The capacitor C15 and R30 are not for filtering a signal, they give time to clock system to start before the level of reset pin become high to start the microcontroller.

  • @desaoaraujo
    @desaoaraujo Před rokem +5

    Just a small correction, you can program another MCU using the ST-Link that's integrated in the Nucleo board, you just need to remove a couple of jumper shunts and you can connect your board via the SWD header.

    • @Graham_Wideman
      @Graham_Wideman Před rokem +1

      To clarify, you're addressing the question that Robert asked at 43:15

    • @TheDrJHo
      @TheDrJHo Před rokem

      Absolutely, I used the nucleo on-board st-link to program an smt32f334 on my custom pcb. Remove jumpers on nucleo and connect custom pcb via jumper cables.

  • @mohammed_saeedzayat1418
    @mohammed_saeedzayat1418 Před rokem +1

    Thanks for the course. However, I wonder if I can use the STM32 Cube IDE environment as exactly real life does for the blinking led first example as a simulation.

  • @paulpichler5089
    @paulpichler5089 Před rokem

    20:00 you can undo it inside the clock configuration window

  • @jozefsoucik3115
    @jozefsoucik3115 Před 3 měsíci

    like your videos and questions. cca 31:00 BTW ... examples are against workflow of STM32 IDE. Because code is generated mostly by setting in IOC.

  • @nazariimoroz6216
    @nazariimoroz6216 Před rokem

    Robert was not learning, he was making sure Greidi isn't making a mistake or misleading the viewers the entire video XD

  • @marcosethais7
    @marcosethais7 Před rokem +1

    do you have plans to take the stm32mp157 course in schematic and pcb?

  • @user-eo5ew1ue3i
    @user-eo5ew1ue3i Před rokem

    Robert the legend

  • @christiankoch4627
    @christiankoch4627 Před rokem +1

    LIN Bus tutorial would ne nice!

  • @klausehrhardt4481
    @klausehrhardt4481 Před 4 měsíci

    Question: all this hall/cmsiss setup config is alteady multitheading?

  • @arunasadeepa1767
    @arunasadeepa1767 Před 9 měsíci

    Another great tutorial😍😍, I just don't understand how the LED turned off when using interrupt coz there wasn't any code line as i saw, can someone tell me how.

  • @kanchanagangadaita7442

    Which cable is to be used for connecting with PC?

  • @947C.Christmas.Siletz.Benton

    That my-friend is the body of the circuits.

  • @nassershehadeh4661
    @nassershehadeh4661 Před 10 měsíci

    Could you guys do a tutorial for simulating stm32 processors in Proteus? I am new to this type of development and simulating is cheaper and more practical than buying and testing

  • @raghudevisetti9382
    @raghudevisetti9382 Před 6 měsíci

    Is there any processor (instruction) simulator for STM32 MCUs on CubeIDE?

  • @yaswanthcdac
    @yaswanthcdac Před měsícem

    sir, why they give double underscore what is the significance of that

  • @nickskywalker2568
    @nickskywalker2568 Před 6 měsíci

    I've got the F746G and I am struggling to find which pin I should activate for the led, anyone can help?

  • @returncode0000
    @returncode0000 Před 5 měsíci +1

    I want to check embedded programming on ARM/STM32 starting with a Nucleo board. Whereever this journey will take me, should I develop on Windows or Mac with STM32CubeIDE? I’ve heared that the industry standard for developing on ARM is Windows most tools, drivers etc).

  • @rajendrailager8281
    @rajendrailager8281 Před 5 měsíci

    After Project explorer my ioc file will not be able to see in the leftside window. Please let me know

  • @cortex-technologies
    @cortex-technologies Před rokem

    Is it possible to start this tutorial if I don't have the hardware(stm32 board)? That thing is not available in my country, aliexpress will require around 30 days for shipping

  • @zerocool3002
    @zerocool3002 Před 3 měsíci +1

    Hello, I am new to the world of STM32, do you recommend programming it from visual studio code, or better from cubeIDE?

  • @nomannosher8928
    @nomannosher8928 Před měsícem

    sometimes issue comes in st board and we dont know reasons why this happened.

  • @thronex4741
    @thronex4741 Před 4 měsíci

    i cant find the STM32F407VET6 development board in the STM32CubeIDE
    what can i do?
    Is there a way to add it?

  • @Silent_Shishya
    @Silent_Shishya Před rokem

    Hi. Great video. I have a question.
    I have been working on a project for 2 days. However, I need to configure an ADC Port and channel as input. However, if i do make changes in the .ioc file and save the config, the auto generation code rewrites the code i worked for the past 2 days. How can i change config without losing my code?

    • @uncommonsensor
      @uncommonsensor Před rokem +2

      Your code needs to be in the appropriate sections commented as "user code"

  • @marcosethais7
    @marcosethais7 Před rokem

    Make stm32mp157 in pcb?

  • @user-eq1pz8qc1o
    @user-eq1pz8qc1o Před 11 měsíci

    Hello guys, im having a trouble with stm32cubeide, basicall when i try to open a new project its says "Code generation could not be done most probably because the necessary firmware package is missing. Not able to complete STM32Cube project creation. See Firmware Updater for settings related to firmware package installation Tips: Please use the Device Configuration Tool, and then use 'Project > Generate Code' to complete the project generation." any helps?

  • @Tezza120
    @Tezza120 Před 2 měsíci

    I'm not a professional programmer or anything but I did learn a big thing about libraries. I didn't know if it's included, the whole thing is added. I thought the IDE was smart enough to only compile what was used in the library.
    So does this mean if you wanted to use just strlng() from string.h....you'd have to copy that string.h library as your own and delete everything that's not needed to save on program size?

  • @polatech-tipps
    @polatech-tipps Před 4 měsíci +1

    Hey, can somebody help me i have a problem, i dont understand why hello World is not displayed on the screen. I have been following each step and all is good (STM32 is connected, code is good...) but on the console is nothing. Have somebody a solution ? Thanks :/

  • @Fnta_discovery
    @Fnta_discovery Před rokem

    Hi dear. I’d love you to give the manner or advice so that I can understand STM32 because when I see a code HAL I panicked suddenly. Best regards 😢

  • @pooper_master1564
    @pooper_master1564 Před rokem

    I followed the steps but I don't see no output in the serial monitor

  • @bormisha
    @bormisha Před rokem

    Too bad most STM32s are unavailable on the market since more than a year now. It's a bad idea to start any new designs with them. But their documentation, software support and low prices for programming tools made them very attractive and easy to start with.

    • @rolfw2336
      @rolfw2336 Před rokem +1

      It's a problem for other micros as well, but you're right, STM chips seem to be totally unavailable since about mid-2021.

  • @user-lp2op9uu1w
    @user-lp2op9uu1w Před rokem +2

    Next tutorial: Where to buy some ;)

    • @remy-
      @remy- Před rokem +2

      Yes that’s holding me back from investing time into this chip. ESP32 has it’s disadvantages, but no shortages.

    • @alperuzi
      @alperuzi Před rokem

      I would really like to know this too :) :)

  • @arisk4
    @arisk4 Před rokem +2

    24:11 can someone explain how uint8_t hello = "Hello"; works? How can Hello be stored in 8 bits?

    • @uncommonsensor
      @uncommonsensor Před rokem +1

      Maybe the 8 bits point to the array's starting address?

    • @arisk4
      @arisk4 Před rokem

      @@uncommonsensor yeah that makes sense. I am not used in programming like that. I would declare it as a string. Is there any difference? Which is better?

    • @uncommonsensor
      @uncommonsensor Před rokem +1

      @@arisk4 Well I'm more familiar with C++, but it does use C strings, which are just arrays of bytes terminated by a 0. Also, arrays typically just point to a location in memory, and then depending on what type of array it is, it will know how to access each element in the array depending on the size of its type, and it's index.
      I'm not sure if that is what is going on here, but it was just an assumption. Maybe the
      marks the end of the array somehow

  • @liamels6282
    @liamels6282 Před 2 měsíci

    This is my brother Bilo

  • @buseacun6788
    @buseacun6788 Před 9 měsíci

    Hello, thanks for the video. I have "no st-link connected" error and I have tried so much thing but I couldnt handle it. Can you give me some advice. Thanks for your interest.

    • @user-pm7iv3oe2u
      @user-pm7iv3oe2u Před 6 měsíci +1

      Did you find a solution?

    • @buseacun6788
      @buseacun6788 Před 6 měsíci

      @@user-pm7iv3oe2u no, I can't find any solution. I try different stm32 but it didn't work too. I gave up.

  • @annaoaulinovna
    @annaoaulinovna Před rokem

    st company should make a dual core mcu.

  • @7alfatech860
    @7alfatech860 Před rokem

    Is there any reason to choose C rather than C++ in setting up a new project?
    FYI, dark mode makes it hard to read the comments in the code

    • @John_Smith__
      @John_Smith__ Před rokem +2

      I think almost all if not all STM32 HAL libraries are written in C and also if you choose to work with FreeRtos for example you will have to use C and not C++.

    • @7alfatech860
      @7alfatech860 Před rokem

      @@John_Smith__ Thanks

    • @kevinp5839
      @kevinp5839 Před rokem +2

      C++ isn't really used that much in professional development. Maybe Arduino hobby stuff.

    • @veskola
      @veskola Před rokem

      @@John_Smith__ It's possible to mix C and C++ even with FreeRTOS and C libraries. In most of simple projects it won't make sense, but if you are developing some platform which produce lot of different firmwares for different products it's possible to get benefit of inheritance and other C++ features (and get penalty of memory usage)

    • @John_Smith__
      @John_Smith__ Před rokem

      @@veskola Oh of course, I agree it is possible but it may make your development actually more difficult. There is the problem of memory usage penalty, and we are talking micro-controllers here. If you are using C++ in order to make it easier to develop for multiple projects ... then C++ can become an issue since you could run into a situation were your code exceeds the memory limitations on one of those projects that uses a lower memory STM32(or other micro-controller). And also using C++ on FreeRTOS does not necessarily make your development easier, some times it can make it more difficult to develop your application.