#1. Intro to STM32F4 Register Based Programming || Clock Setup || LED Blinking || NO HAL

Поділитися
Вставка
  • Опубліковано 19 лис 2024

КОМЕНТАРІ • 182

  • @kenwallace6493
    @kenwallace6493 4 роки тому +63

    Finally, a video that makes sense, that uses the basic documentation and avoids the cryptic HAL nonsense. Thanks and keep up the good work.

  • @polkijain97
    @polkijain97 4 роки тому +13

    Great video. You are a pioneer in STM and ARM developer resources. Really glad to see your initiative to help the next generation move to the more advanced STM32 from Arduino.

  • @carsten7220
    @carsten7220 3 роки тому +2

    Thank you very much! I tried around with HAL, which makes clock configuration very easy, but I found out that it is so much slower than writing directly to registers for GPIO ports (factor 10 perhaps). So I decided not to use HAL for my project, but I was stuck a whole day with the clock configuration. I think the most part of it was fine, but the mistake was not to wait for the clocks to be ready like in your video. That helped and now it works! I will watch your other videos to avoid problems when moving on with the project!

  • @sampoteste
    @sampoteste 4 роки тому +7

    Awesome video. Thanks, it helps take the scary part of bare metal coding away. I will be looking forward to the rest of the videos in this series. I presume that code written like this takes much less memory so those of us using the free version of Keil can do more within its code size limitations. Thanks again.

  • @paulg.3067
    @paulg.3067 3 роки тому +1

    This video is worth gold! Helped me a lot to start from scratch without using LL or HAL :)

  • @mprone
    @mprone 4 роки тому +3

    Your videos are so useful for embedded software students! I really appreciate your work

  • @elishaul4125
    @elishaul4125 4 роки тому +2

    simply incredible, Thank you very much, Please do not forget DSI

  • @High_Rate136
    @High_Rate136 2 місяці тому

    This video took me hours to get through as I just constantly read and read about everything.

  • @aliserbetci8339
    @aliserbetci8339 2 роки тому

    Thanks to the background music you chose, I had fun like watching a cartoon.

  • @MrHause13
    @MrHause13 4 роки тому +1

    Again great job, I always find on your channel what I need. Datasheet + your videos are perfect combination!

  • @WeTravel2023
    @WeTravel2023 4 роки тому +3

    It's amazing ....please make a series of these videos . Including i2C , SPI , ADC n all ....

    • @ControllersTech
      @ControllersTech  4 роки тому +4

      yup.. that's the plan

    • @ferdinvivian9336
      @ferdinvivian9336 4 роки тому +1

      @@ControllersTech can you teach how to program STM blueNRG2,, Bluetooth module.. transmit, receive and mesh network,, please

  • @SmeeUncleJoe
    @SmeeUncleJoe 2 роки тому

    You are certainly the best when it comes to putting together videos on STM ARM. Please consider publishing a book or putting a course up on one of the MOOC providers.

  • @КириллГерасимов-к8ч

    IT IS A FANTASTIC VIDEO! I've finally understood how to work with all of this! Thank you very much!

  • @noweare1
    @noweare1 4 роки тому

    That's how I first learned to program stm32 . The manual explains in terms of the registers so it's the obvious way to get started. The HAL Low Level drivers are perfect for register programming because the way the functions are written self documents your code. After a while though you'll want to use HAL drivers as they offer a good high level way to get things done.

  • @nileshdharap
    @nileshdharap 11 місяців тому

    Great Video. I was able to follow and surprisingly it worked in the first try, not a complex code I know 😅 but feels good.
    Thanks again

  • @yadniksn6657
    @yadniksn6657 4 роки тому

    Thank u for this vdo.
    Adding voice in vdo help me to understand things more clearly. 🙂🙏

  • @yasirfaizahmed2003
    @yasirfaizahmed2003 4 роки тому +3

    I almost feel guilty after watching this video for free and with no extra cost, thankyou

  • @berrywhite1075
    @berrywhite1075 4 роки тому

    Very useful to have a first approach to this micro. Many thanks for your job and effort.

  • @salehpaz
    @salehpaz 3 роки тому

    Thank you. This video is very helpful. Much practical and useful than ST tutorial videos.

  • @ilteriskutlukyildirim4104
    @ilteriskutlukyildirim4104 4 роки тому +1

    Great series, I would you like to keep series.

  • @muratarslan7122
    @muratarslan7122 4 роки тому +2

    Great work. Exactly what I was looking for. Thank you!

  • @steffenreck7838
    @steffenreck7838 2 роки тому

    Great Video. After a while I even liked the music.

  • @caleb7799
    @caleb7799 Рік тому

    Thanks for the great videos! One request, please find a way to keep the ads on your website from covering the tutorial information. Also, If I resize the browser, so I can fit both my IDE and the browser side-by-side, all of the ads cover up the information as well.

  • @TheTangens
    @TheTangens 4 роки тому +1

    Thats exactly the video i was looking for a long time. Thank you for sharing this with us 👌🏻👌🏻👌🏻

    • @EdwinFairchild
      @EdwinFairchild 3 роки тому +1

      you havent been looking that well, been doing this for years on my channel lol

  • @ChG85
    @ChG85 4 роки тому +1

    Thank you for this video....I'm really looking forward to the next one 👍😉

  • @m.anasbaig
    @m.anasbaig 3 роки тому

    You are doinng an incredible job, Hats off to you

  • @sam-pd6zi
    @sam-pd6zi 3 роки тому

    The HAL in stm series is only meant for those who are already good in register level programming, learners can never learn register level programming by that,... this is the video i can easily understand what the hell is happening ,thanks a lot sir

    • @ControllersTech
      @ControllersTech  3 роки тому

      HAL is easier compared to registers. I don't think you need to know registers to program in HAL. Obviously registers gives you more control over your MCU.

    • @sam-pd6zi
      @sam-pd6zi 3 роки тому

      @@ControllersTech yeah,my misunderstanding,but i want to learn register level programming

  • @snookiewozo
    @snookiewozo 3 роки тому

    Yes, this is awesome! Keep it up!

  • @markday3145
    @markday3145 3 роки тому +1

    I appreciate the detail, including referencing CubeMX and the programming manual. The background music was a bit distracting.
    As a matter of coding style, when you have a while loop that has no body (where you are waiting for the HSE and PLL to become ready), I think it helps to use curly braces, or put the semicolon on the next line (ideally with a comment like "do nothing" or "wait until ready". A semicolon at the end of the line with the "while" keyword is easy to overlook, or looks like a function call.

  • @nihasilev
    @nihasilev 2 роки тому

    👍👍 İşe yarar, ilham verici bir video. Elinize sağlık..

  • @Cptnbond
    @Cptnbond 4 роки тому

    Awesome episode.

  • @caleb7799
    @caleb7799 Рік тому

    they have so many damn versions of this hardware good luck finding something that is exactly like yours on youtube...lol

  • @yaswanthraj5285
    @yaswanthraj5285 Місяць тому

    Mannn you're amazing

  • @wegi9621
    @wegi9621 10 місяців тому

    Brillant tutorial absolutly love it. You did enable external oscillator which exactly doesn't exist as we can see on the board. I think you should choose Bypass clock source. What exactly running now this ARM - Bypass clock source or internal oscillator?

    • @ControllersTech
      @ControllersTech  10 місяців тому

      It works both ways, by bypassing the clock and by selecting external crystal. So either is fine.

    • @wegi9621
      @wegi9621 10 місяців тому

      @@ControllersTech Yeah - thanks for your answer.

  • @nguyenduykhoi7819
    @nguyenduykhoi7819 3 роки тому

    Thank you very much Sir!

  • @arif-l1y3p
    @arif-l1y3p 9 днів тому

    i do not dee "startup check box" under device in runtime envoirnment manage window in keil 5.35---why

  • @fandusmercius723
    @fandusmercius723 2 роки тому

    great vid thanks! I got a question how to know following 7 steps during sys clock config

  • @alejandrojulian804
    @alejandrojulian804 2 роки тому

    Are you conecting the external crystal in the board for the microcontroller? Because i can't see it on your nucleo board

  • @vivek1339
    @vivek1339 4 роки тому

    Great Video. But how do we configure the comparator and turn on/off an onboard LED based on the output of the comparator.
    Thank you

    • @ControllersTech
      @ControllersTech  4 роки тому +1

      That's a very advance topic, considering this is just the beginning of this series

  • @MikhailGoncharov-tl4cr
    @MikhailGoncharov-tl4cr 6 місяців тому

    Thank you a lot

  • @455ecelochani3
    @455ecelochani3 4 місяці тому

    what must be VOS value for stm32F401re board?

  • @sharana.p6161
    @sharana.p6161 3 роки тому

    Thank you for the video.
    I have doubt, that the Nucleo board used in this video no external oscillator is connected, but we have programmed the controller as an external oscillator. Please tell us how.

    • @ControllersTech
      @ControllersTech  3 роки тому

      It have the one for the st link. It uses that..

  • @Steven_Bennett_YT
    @Steven_Bennett_YT 3 роки тому

    I like your approach to non-HAL coding for setup and configuration of the MCU system and peripheral blocks. I do however miss the easy access to useful Arduino functions e.g. map(), now I know this could be hand coded but would it be possible to add an Arduino header file that contains these functions. For example I noticed in VSC-PlatformIO that when developing an ESP32 project, and probably other MCUs, an #include is automatically added, which does enable Map(), and presumably the rest of the Arduino functions, to be used; I would really like to see a video on this subject.

    • @ControllersTech
      @ControllersTech  3 роки тому

      You can create one header file yourself consisting of all those functions..
      I don't think it's necessary to make a video on that. Just google the source code of those functions and collect them at one place

  • @Mile-High-Trader
    @Mile-High-Trader 2 роки тому

    Very good, I really learned a lot ... I just need a clarification on Clock Configuration in Cube MX: I am using a STM32F401RE Nucleo board and I intend to use the 8Mhz ST-Link Oscillator on the board, is this still to be configure as crystal/ceramic Resonator or as Bypass clock source ... Thank you

    • @ControllersTech
      @ControllersTech  2 роки тому

      Either is fine.. It works with both. You can use bypass as I have seen some ST tutorials doing that

  • @nahid5552000
    @nahid5552000 2 роки тому

    Thanks for this video. However in configure target options the xtal frequency is greyed out and I cannot change. Could you suggest How can I change the frequency. I am using STM32F401CCU6 microcontroller and I need to give 84 Mhz.

    • @ControllersTech
      @ControllersTech  2 роки тому

      You need to enable the external HS crystal under the RCC tab.

  • @mahianabosszuallo9726
    @mahianabosszuallo9726 3 роки тому +1

    If the void delay(uint32_t time) function does not work for you, write void delay(volatie uint32_t time) instead to avoid compiler optimization.

    • @sushivamsingh8069
      @sushivamsingh8069 2 роки тому

      Thanks alot Mahiana. This was really very helpful as I was stucked here... Can u please elaborate why the issue resolved after using volatile...

    • @mahianabosszuallo9726
      @mahianabosszuallo9726 2 роки тому

      @@sushivamsingh8069 As you can see in the video it properly worked without using "volatile". However we followed the steps of the video and done exactly the same thing. So what is the difference, why we need "volatile"??
      We need it because our compilers differ. Let's look at the functions body: while(time--);
      If it is true time is decremented. The function returns nothing, and after execution the value of time is lost.
      In our case the compiler just thought: "Hey here is a function that gets a parameter, but wait!! any modification we make on that will be lost and we don't even use it in any proper conditions. Then why should I contain this parameter in that function? Let's just skip it to optimize runtime and memory."
      In the video the other compiler thought it might be important so compiled it.
      If we make a variable "volatile", we tell the compiler that don't make any excuses and skip, just compile it as it is.
      Most of the time when you interact with hardware it is out of the compiler's scope, for example it can't see if a variable is modified by hardware, in these cases the code will only work if you use volatile variables.

    • @sushivamsingh8069
      @sushivamsingh8069 2 роки тому

      @@mahianabosszuallo9726 It was really very informative from your side and I am very thankful to you...

    • @DmFro
      @DmFro 2 роки тому

      MVP comment, saved me having to spend hours figuring out what went wrong! Thanks

  • @GoracyKanal
    @GoracyKanal 4 роки тому +2

    wow bro :D

  • @niviet607
    @niviet607 3 роки тому

    Hi, I have STM32F4 Discovery but I have difficulties setting up the clock. I checked the reference manuals for register differences, I checked the syntax but I didn’t find any problems. When I download the code to the Discovery Board regardless of the delay function my LEDs just lights up dim and doesn’t blink or do anything really. I had check delay but it's not work. Can you help with this ?

    • @ControllersTech
      @ControllersTech  3 роки тому

      Debug the code. It might be blinking very fast..

  • @ortapiero7178
    @ortapiero7178 2 роки тому

    Great video.
    But how could i know the steps?
    Every moment i have more questions…
    How would i know to config the voltage regulator after enable APB?
    I can i develop that mind set to figure this kind of things be myself?
    I want to realy learn and not to be a copycat.
    Where it is written in the data sheet or manual reference?
    Please tell me the secret

    • @ControllersTech
      @ControllersTech  2 роки тому

      I have explained things. As mentioned, the clock configuration is something very complicated in ARM, I took the help from the CUBEMX configuration.

    • @ortapiero7178
      @ortapiero7178 2 роки тому

      @@ControllersTech yeah i figured it out after i watched again, sorry.
      And thank you!

  • @DanhNguyen-qc2xt
    @DanhNguyen-qc2xt 3 роки тому

    Thank you for this tutorial! But how can we see our actual speed to check our code right or wrong? Because I finished this tutorial and now studying your tutorial about TIMER and USART, but my clock seems to run slower as expected. Therefore, 1 second (on TIMER tutorial) on my board is relatively slower than reality, and the Hercules software can't recognize the letter 'G' from the beginning.

    • @ControllersTech
      @ControllersTech  3 роки тому

      Your clock configuration might be wrong. Most probably the crystal frequency. Check if you have used the proper crystal frequency.

  • @cohai6913
    @cohai6913 3 роки тому

    Thanks for sharing

  • @shantoislam8223
    @shantoislam8223 Рік тому

    how did you know that procedure.

  • @vinothkannan1570
    @vinothkannan1570 4 роки тому +1

    excited to see this video please make one video on CAN ,FreeRTOS without HAL

  • @phcatuan
    @phcatuan 7 місяців тому

    In step 2, after I set the POWER ENABLE CLOCK in RCC_APB1ENR, how can I set the VOLTAGE REGULATOR because I'm using STM32F103C8 which doesn't have VOS in bit [15:14] like F446 does?
    And what is the purpose of this bit?

    • @ControllersTech
      @ControllersTech  7 місяців тому

      There is another video for 103C8. Look in this playlist.

  • @alfafatansyah
    @alfafatansyah Рік тому

    my Xtal is undefined, can't edit. Anyone can solve this problem?

  • @_NguyeninhKhoi
    @_NguyeninhKhoi Рік тому

    How do you know for sure that the HSE is operating at 8Mhz?
    Because I see in the file system_stm32f446xx.c is defining the HSE at 25Mhz
    #if !defined (HSE_VALUE)
    #define HSE_VALUE ((uint32_t)25000000) /*!< Default value of the External oscillator in Hz */
    #endif /* HSE_VALUE */
    #if !defined (HSI_VALUE)
    #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
    #endif /* HSI_VALUE */
    and I don't see you configuring the HSE's frequency back to 8Mhz.

    • @ControllersTech
      @ControllersTech  Рік тому

      "How do you know for sure that the HSE is operating at 8Mhz?"
      You can check the next video in the series, where the timer is being used to setup the exact delay using this configuration.
      "Because I see in the file system_stm32f446xx.c is defining the HSE at 25Mhz"
      That value will be used if you use the function SystemCoreClockUpdate(), which is also defined in the system file. If you enable the HSE crystal, it will simply run at it's clock, which is 8MHz in my case.

  • @knowledgeintamilkit768
    @knowledgeintamilkit768 2 роки тому

    Please arrange the playlist video with numbers 1 ,2,3... from basic to expert....

    • @ControllersTech
      @ControllersTech  2 роки тому

      You are commenting without even looking at the playlist ?

    • @knowledgeintamilkit768
      @knowledgeintamilkit768 2 роки тому

      @@ControllersTech I already checked your playlist, its seems not in order. am confused which one is first video for STM32 Budding persons.

    • @ControllersTech
      @ControllersTech  2 роки тому

      Well this one is not an ESP32 video.
      The ESP32 series doesn't have many videos yet, that's why they aren't arranged. So you just see what you are interested in.

    • @knowledgeintamilkit768
      @knowledgeintamilkit768 2 роки тому

      @@ControllersTech STM32 Only..

  • @brighter3134
    @brighter3134 3 роки тому

    can i use same code on stm32f407vg ? or i need to change some code ?

  • @anilsuha5301
    @anilsuha5301 Рік тому

    how to derive the programming steps for a peripheral(say GPIO) from scratch from reference manual of STM32 controllers?

  • @chakrarokaya3952
    @chakrarokaya3952 3 місяці тому

    Hi, I downloaded code and flash my Nucleo-F446RE board. The LED remains ON all the time, no blinking.
    Further, I also commented in the program:- Pin OUTPUT and while loop (shown below). still the LED is ON. I am surprised. What could be the reason, if any one have encountered this ? thank you
    // 2. Set the Pin as OUTPUT
    //GPIOA->MODER |= (1

  • @BeratcanCekic
    @BeratcanCekic Рік тому

    Hello Sir , firstly thank u very much for such an awasome playlist . I want to ask a question that im struggling with over 3 days and couldnt solve the problem which is when i write above codes and watch the changes of PLLCFGR register , no bit changes . I try a lot of ways and i solved that by calling the function RCC_DeInit();. But why my codes cant work withour RCC_DeInit ? And how can i solve that problem ? Best Wishes.

    • @ControllersTech
      @ControllersTech  Рік тому

      Maybe the reset values for your MCU are a bit different. What MCU are you using anyway ?

    • @beratcan21
      @beratcan21 Рік тому

      @@ControllersTech stm32f407vet6 - discovery board - . Sir im still trying to find a solution but i cant solve even looked to over 30-40 projects on the internet . The main problem is : even if i assign any operation - such as RCC->PLLCFGR |= (1

  • @eriksamanezgaliano6173
    @eriksamanezgaliano6173 4 роки тому

    thank you !!!

  • @mhassaankhalid1369
    @mhassaankhalid1369 7 місяців тому

    by default X3(High speed External) is not soldered, why did you enabled it when it was not there?

    • @ControllersTech
      @ControllersTech  7 місяців тому

      It uses the crystal from st link.

    • @mhassaankhalid1369
      @mhassaankhalid1369 7 місяців тому

      @@ControllersTech ohh it uses the external clock from the mcu on stlink, thanks a lot

  • @EdwinFairchild
    @EdwinFairchild 3 роки тому

    why are you using Keil though? When CubeIDE has no code size limit

    • @ControllersTech
      @ControllersTech  3 роки тому

      I don't know how to setup those startup files and all in cubeide..

    • @EdwinFairchild
      @EdwinFairchild 3 роки тому

      @@ControllersTech just use a regular cube project and delete all HAL code and start with clean main

    • @ControllersTech
      @ControllersTech  3 роки тому +1

      The point with this series is not to involve cubemx...
      I only used it in this video for rcc setup. It's not involved in any other video in this series..

    • @EdwinFairchild
      @EdwinFairchild 3 роки тому +1

      @@ControllersTech fair enough

    • @SanelKeys
      @SanelKeys 2 роки тому

      @@EdwinFairchild one of the best if not the best course on bare metal STM programming is yours.

  • @balaji5384
    @balaji5384 3 роки тому

    👌👌👌👍👌👏👌👏👌👍👌👏👌👍👌👍👌👏👌👍👌👍👌👍👌👌👌👌👌 one doubt u don't have external 8mhz crystal on your nucloe board, but how you are setting HSE BIT plz explain??!!

    • @ControllersTech
      @ControllersTech  3 роки тому

      There is one for the st link. It is being used.

    • @balaji5384
      @balaji5384 3 роки тому

      @@ControllersTechfirst thank you the quick response 👍👍👍👍👏👏👏. X1 can be used both for stlink and stm32f as HSE Is that correct, I had the doubt bcz X3 is empty in nucleo board..

  • @m-electronics5977
    @m-electronics5977 3 місяці тому

    8:09 Isn't it important what value is programmed first? Because when I write a value in the e.g. 4th bit of a register and then a value in the e.g. 6th bit then the first value will be overwritten or not?

    • @ControllersTech
      @ControllersTech  3 місяці тому

      That's why we perform bitwise or ( | ) and bitwise AND (&). They don't modify other bits of the register.

    • @m-electronics5977
      @m-electronics5977 3 місяці тому

      @@ControllersTech Hmmm, then something must be wrong in some other code from me, there I must began from the MSB what I need to set. Otherwise the lower bits were overwritten.
      And I used OR and AND

    • @m-electronics5977
      @m-electronics5977 3 місяці тому

      @@ControllersTech But I had read that when we perform e.g.
      REG |= (1

    • @m-electronics5977
      @m-electronics5977 3 місяці тому

      @@ControllersTech I´ve played around a little bit with bitwise operations in C (not on a microcontroller) and when I do something like that:
      uint8_t test = 144; //(0b1001000)
      test &= (0

  • @vinothkannanr2804
    @vinothkannanr2804 3 роки тому

    interface SD card module with stm32 NO HAL waiting for your video

    • @ControllersTech
      @ControllersTech  3 роки тому

      😔 i was hoping to skip over SPI

    • @vinothkannanr2804
      @vinothkannanr2804 3 роки тому

      @@ControllersTech we will be happy if you can make one video in spi

  • @shubhamkumaragarwal7347
    @shubhamkumaragarwal7347 Рік тому

    Hlo @ControllersTech,
    I am using STM32L476RGT6, I used the code as you have done in this video but I am not able to blink the led, can you please tell me what should I change to make it blink the led.
    Code:
    #include "stm32l476xx.h"
    void SysClockConfig(void);
    void GPIO_Config(void);
    void Delay(uint32_t delay);
    void SysClockConfig(void)
    {
    /* STEPS FOLLOWED
    1. Enable HSE and wait for the HSE to become ready
    2. Set the POWER ENABLE CLOCK and VOLTAGE REGULATOR
    3. Configure the FLASH PREFETCH and the LATENCY related settings
    4. Configure the PRESCALERS HCLK, PCLK1, PCLK2
    5. Configure the MAIN PLL
    6. Enable the PLL and wait for it to become ready
    7. Select the Clock Source and wait for it to set
    */
    #define PLL_M 4
    #define PLL_N 80
    #define PLL_P 0 // PLLP = 7
    #define PLL_Q 0 // PLLQ = 2
    #define PLL_R 0 // PLLR = 2
    // Step 1
    RCC->CR |= RCC_CR_HSEON;
    while(!(RCC->CR & RCC_CR_HSERDY));
    // Step 2
    RCC->APB1ENR1 |= RCC_APB1ENR1_PWREN;
    PWR->CR1 |= PWR_CR1_VOS;
    // Step 3
    FLASH->ACR |= FLASH_ACR_ICEN | FLASH_ACR_DCEN | FLASH_ACR_LATENCY_4WS;
    // Step 4
    RCC->CFGR |= RCC_CFGR_HPRE_DIV1; // AHB PRESCALER
    RCC->CFGR |= RCC_CFGR_PPRE1_DIV1; // APB1 PRESCALER
    RCC->CFGR |= RCC_CFGR_PPRE2_DIV1; // APB2 PRESCALER
    // Step 5
    RCC->PLLCFGR |= (PLL_M

    • @shubhamkumaragarwal7347
      @shubhamkumaragarwal7347 Рік тому

      If anyone here knows what could be the mistake, please let me know as soon as possible.

  • @mubasheer5584
    @mubasheer5584 Рік тому

    Hi sir. Where can I get the procedure to do it step by step with sequence?

    • @ControllersTech
      @ControllersTech  Рік тому +1

      Its not written anywhere.. this something you learn by programming lower end mcus..
      For some peripherals like uart, i2c you can see the reference manual.

    • @mubasheer5584
      @mubasheer5584 Рік тому

      @@ControllersTech okay got it. ty sir.

  • @salehpaz
    @salehpaz 3 роки тому

    I have tried to modify the registers and run it through STM32G071 but could not see the LED blinking.

    • @ControllersTech
      @ControllersTech  3 роки тому

      Put a breakpoint inside the while loop and step over each statement. Then see if it blinks

  • @nihasilev
    @nihasilev 2 роки тому

    "use defoult compiler version 5" runing..
    BUT "use defoult compiler version 6" not runing...
    LED is on, but does not go out.. why??

  • @chilipepper8281
    @chilipepper8281 11 місяців тому

    Greetings, can someone explain to me why the author put 8 MHz instead of 25 MHz when configuring the timers in the CubeMX. And how it is reflected in the values that the author writes in the registers. Thanks in advance for your help.

    • @ControllersTech
      @ControllersTech  11 місяців тому

      Because the board has 8 MHz crystal on it, not 25. And this affects your entire clock system of the MCU.

    • @chilipepper8281
      @chilipepper8281 11 місяців тому

      @@ControllersTech Thanks a lot, this confused me a bit, but now I understand that the HSE is fixed and cannot be changed outside of the MCU.

  • @sehaaltnkaynak9327
    @sehaaltnkaynak9327 3 роки тому

    Hello , why do we need to configure power enable register and regulator register ? I didnt get it .

    • @HendersonHood
      @HendersonHood 3 роки тому +1

      To save power, no clock is applied to most peripherals and they are disabled

  • @Steven_Bennett_YT
    @Steven_Bennett_YT 3 роки тому

    On line 22 I am puzzled as to how RCC->CR |= RCC_CR_HSEON; sets the HSEON bit 16, I can see how RCC->CR |= 1

    • @ControllersTech
      @ControllersTech  3 роки тому

      Check the definition of HSEON bit in the header file, it is 1

    • @Steven_Bennett_YT
      @Steven_Bennett_YT 3 роки тому

      @@ControllersTech OK I see, thanks for that and all your very informative videos.

  • @MirusWoozy
    @MirusWoozy 3 роки тому

    Great stuff, really! I have muVision 5.36 and in the Options for Target it's not possible to modify Xtal value. Any suggestion? Thanks a lot!

    • @ControllersTech
      @ControllersTech  3 роки тому +1

      Try without modifying. I think it works fine

  • @MonirMostafiz
    @MonirMostafiz 11 місяців тому

    sir which pdf reader are you using?

  • @quangnguyennhu2998
    @quangnguyennhu2998 3 роки тому

    Dear Sir,
    Where do you set HSE Frequency ? I couldn’t find it in this code

    • @ControllersTech
      @ControllersTech  3 роки тому

      You don't set the frequency. Based on HSE value, you set the PLLs to obtain the required clock.

    • @quangnguyennhu2998
      @quangnguyennhu2998 3 роки тому +1

      @@ControllersTech But where do you know HSE value from if you don't set it up ?

    • @quangnguyennhu2998
      @quangnguyennhu2998 3 роки тому +1

      I saw that HSE_VALUE is a constant defined in system_stm32f4xx.h file (default value 25 MHz), but you caculate based on HSE = 8 MHz.

    • @ControllersTech
      @ControllersTech  3 роки тому

      It's a physical crystal on your board. I have 8 MHz so I take 8.

    • @quangnguyennhu2998
      @quangnguyennhu2998 3 роки тому

      ​@@ControllersTech I got it. I think this value we can configurate. Thank you a lot.

  • @vultureig9277
    @vultureig9277 3 роки тому

    Can we use stm32CubeIDE for register level programming?

    • @ControllersTech
      @ControllersTech  2 роки тому

      We can't create the project from the scratch in cubeIDE (atleast not that i know of).
      You can still generate the files from cubemx and use registers instead of HAL

    • @vultureig9277
      @vultureig9277 2 роки тому

      Ok. Thanks

  • @firstprinciples9854
    @firstprinciples9854 Рік тому +1

    Hi, First of all thanks for a nice tutorial. I think as a safe step, we need to reset the bits for PLLP, PLLM and PLLN in PLLCFGR register to zero first. Otherwise doing OR operation would result in erroneous value for some boards. This was the case with me as I was trying to get System Clock of 100Mhz. Only after resetting those bits to zero could I make the OR operation work correctly and get desired frequency. I verified my results by running the SystemCoreClockUpdate function provided in system_stm32f4xx.c to see the value of SystemCoreClock as 100MHz (Using HSE_VALUE of 8MHz).

  • @mohamedhalaldeen2517
    @mohamedhalaldeen2517 3 роки тому

    Hi
    where did you find the steps to configure the clock?

    • @ControllersTech
      @ControllersTech  3 роки тому +1

      Well they are not written anywhere as per my knowledge.. so i did research and made a list like that.

    • @mohamedhalaldeen2517
      @mohamedhalaldeen2517 3 роки тому

      @@ControllersTech thanks and a really great awesome series for ppl who want to experience programming through registers.

  • @ilkeraykut7064
    @ilkeraykut7064 3 роки тому

    Sir,Why did you use PWR register?

    • @ControllersTech
      @ControllersTech  3 роки тому

      So that we can configure the voltage regulator

  • @narayananani6904
    @narayananani6904 2 роки тому

    please share the link stm32 cube ide

    • @ControllersTech
      @ControllersTech  2 роки тому

      You can just google it and download from the ST's website

  • @thisismazhar
    @thisismazhar 3 роки тому

    Hi! this video is awesome. But I have a confusion. can anyone solve it?
    What is the difference between these two of codes?
    while(!(RCC->CR & RCC_CR_HSERDY));
    while((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL);
    Is this just way of coding or make any difference.

    • @ControllersTech
      @ControllersTech  3 роки тому +1

      First one waits until the HDRDY bit is 1.
      Second one waits until SWS is equal to SWS_PLL

    • @thisismazhar
      @thisismazhar 3 роки тому

      @@ControllersTech Thank You very much, I appreciate Your response.

  • @karthikps3892
    @karthikps3892 3 роки тому

    warning: no previous prototype for function 'GPIO_Config'.... What is the error?

    • @ControllersTech
      @ControllersTech  3 роки тому

      make sure you are using some parameter for GPIO_Config, when defining it
      for eg-> GPIO_Config() { something} is not a proper method
      but GPIO_Config(void) { something} is the correct one

  • @skywalker778
    @skywalker778 4 роки тому

    Help! My TIM2 clock is realllllyyy slow...

    • @ControllersTech
      @ControllersTech  4 роки тому

      Dear LUKE can u explain the issue

    • @skywalker778
      @skywalker778 4 роки тому

      @@ControllersTech after following the tutorial with the same development board, the TIM2 is so slow that when blinking an LED it is visible to they eye, with PSC=9, ARR=20

    • @ControllersTech
      @ControllersTech  4 роки тому

      What's the APB1 clock ?

  • @khanhluat8996
    @khanhluat8996 3 роки тому

    .