#8 ARM Microcontroller Tutorial - Change the Internal Clock speed! (automated and manual approach)

Поделиться
HTML-код
  • Опубликовано: 10 мар 2022
  • Purchase my new book: Arm Microcontroller Programming and Circuit Building Volume 1
    amzn.to/3LFRaU5
    Learn about bitwise operations:
    • 11. Arduino for Produc...
    Change the internal clock speed of the STM32 microcontroller to 48MHz or whatever speed your microcontroller can handle!
    Links to the software:
    STM32CubeIDE: www.st.com/en/development-too...
    STM Studio: www.st.com/en/development-too...
    STM32CubeMonitor: www.st.com/en/development-too...
    Parts you will need in your prototyping environment:
    Kits to get you up to speed quickly:
    newbiehack.com/Categories/ARM
    If you already have the microcontroller, here are some breakout boards to use:
    64 pin - amzn.to/3rUXeiq
    48 pin and others - amzn.to/3IVkC6D
    STM-Link V2 Programmer:
    newbiehack.com/categories/new...
    amzn.to/3IIZlgj
    Prototyping Breadboards:
    newbiehack.com/categories/new...
    amzn.to/3o2Nh1g
    Resistor Assortment Kit:
    amzn.to/3H4R3ii
    Solid core hook-up wire 22 AWG:
    amzn.to/3IDGinA
    amzn.to/3g5TKUJ
    LEDs and Displays:
    newbiehack.com/Categories/LCD...
    amzn.to/3Az1zf7
    Trimmer potentiometers:
    newbiehack.com/Categories/Pot...
    amzn.to/3H6q067
    The Dynamixel servo I will be using in the USART videos:
    amzn.to/35s3qHl
    Microfarad Capacitor Assortment:
    amzn.to/32BIX1G
    Capacitors on Newbiehack.com:
    newbiehack.com/Categories/cap...
    Electrolytic Capacitor Assortment:
    amzn.to/33TtLxt
    The cheap oscilloscope that I use (because it's cheap and will work all of the projects in these tutorials): amzn.to/2rSHnBa
    A better oscilloscope and the one I would recommend: amzn.to/2qizK5M
    The brand of the multimeter that I use and the one I recommend: amzn.to/2qicUez
  • КиноКино

Комментарии • 50

  • @markday3145
    @markday3145 2 года назад +5

    It's good practice to set up all of the timer's configuration (prescaler, ARR, capture/compare, interrupts, DMA, etc.) and then set the enable bit. As soon as you set the enable bit, the timer starts running with whatever values were in those registers. It's not a big deal with an interactive demonstration of timing like this, but if you were using the timer to generate an external signal, control another peripheral, etc., then you could get a glitch initially.

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад

      Thanks. I may mention this in the book, but I will definitely keep this in mind when I use timers for external pulses and such.

  • @PatrickHoodDaniel
    @PatrickHoodDaniel  2 года назад +1

    Here is the updated speed change video I promised. I show you how to change the speed using the autogenerated code as well as the manual register level code. I hope you enjoy and if you haven't subscribed, make sure you do if you enjoy my content. Thank you all so much for spending your valuable time with my content. I am truly grateful!!

  • @ferencszabo3504
    @ferencszabo3504 2 года назад +2

    this is the tutorial that I've needed, pushing myself out from the AVR, Esp confort zone, i didn't know that stm has this cool IDE either

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад

      Yes! On to the next level!! Thanks for the kind words.

  • @selimsagr446
    @selimsagr446 2 года назад +1

    Good to see your videos again! Thank you for your great effort.

  • @vamsiaccount8592
    @vamsiaccount8592 2 года назад +1

    Sir Don't stop making vidoes ur Aresome 😀

  • @fishntools
    @fishntools 2 года назад +2

    Awesome., appreciate the clarity! 👍

  • @elishaul4125
    @elishaul4125 2 года назад +1

    Thank you very much for excellent video and detailed explanation at registers level, really a pleasure

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад +1

      You're welcome. I am so glad you are enjoying the videos.

  • @intjengineering
    @intjengineering 2 года назад +1

    I don't mind you doing all the LL stuff, after all, HAL code may be bulkier at times, and also, knowing how to program the registers allows you to do more with the MCU(like creating your own PMW signal as you mentioned on the other guy's comment), however, I hope you keep going through the HAL Part - the .ioc, how to set up the pins using CubeMX, going through the generated code and so on. I have the H757XI Eval Board and damn, it's soooo much to do, if you do it at register level. The LCD thing, for example? Dear Lord😂😂
    Anyway.
    I am loving your series. Thanks for everything.
    Greetings from Germany.

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад +1

      True that! The LCD specifically is a great practice in I/O, so once you understand the LCDE, there really isn't anything you can't do. In fact, to expand on the register level stuff, you can create features on the chip that actually don't exist.
      I will definitely include all of the HAL and autogenerated code explanations.

  • @kayakMike1000
    @kayakMike1000 2 года назад +1

    Well... That code generator for the MCU configuration registers is pretty durn cool!!! Does this microcontroller have that built-in SysTick counter/timer? That tiny SAMD controller has it, but I think it's optional on cortex m0

  • @guser210
    @guser210 2 года назад +2

    16bit = 65535 :) awesome video very detail.

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад +1

      I'm a total nerd!! Haha

    • @Nabilphysics
      @Nabilphysics 2 года назад +1

      @@PatrickHoodDaniel that's why we love your video. Mentioning such low level details really helpful

  • @mic03311
    @mic03311 2 года назад +2

    This is brilliant 👍 Thanks 😊 I really enjoy how you guide the code with the user manual. Every steps is clearly justified.
    Are you typically relying on the cube UI or going low level at the register level when you setup the peripherals?

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад +2

      Thanks for the kind words. I always use register level code. I only started with the CUBE UI because it was requested on my channel.

  • @elishaul4125
    @elishaul4125 2 года назад +1

    I received the book through Amazon and the equipment from your site, I will be happy to buy the book as a PDF file, (a little hard to read ...)

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад

      I will see what I can do about that. Did you get the paperback, or the kindle version?

  • @mychromebook9935
    @mychromebook9935 Год назад

    I'm enjoying the videos. The hardest part for me was the ST LINK, it seems CubeIDE doesn't like the st clones anymore and it won't upgrade the firmware. So I bought an official st link and we will see how it goes. Thank you

  • @asadraja377
    @asadraja377 2 года назад +1

    Hi. Just came across your videos and I only wish the RUclips algorithm showed me your AVR playlist sooner. Wasted some years with slapping together Arduino, components and libraries without really understanding what is going on under the hood. So, I'm very excited with this series.
    I want to buy your book but I couldn't really see a table of contents on Amazon. Do you cover mostly low level or a mixture of HAL and low level in the book? I'm mostly interested in low level since it is transferable to other controllers and one is not limited to an API from one particular OEM. Thank you.

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад

      The book contains all register level code, but it is simple, so you should have no problem with it. There are a lot of projects in the book that you can get started immediately, so I really do encourage getting the book. I am a little biased, of course, but I initially wrote the book to serve as my personal notebook.

  • @stephenwhite506
    @stephenwhite506 2 года назад +1

    I wonder if there was a size difference in the elf\flash between the HAL and register versions of the code?

  • @Nabilphysics
    @Nabilphysics 2 года назад +1

    Thanks for this brilliant video. May be you can connect an oscilloscope and show the wave and timing which could have been more interesting. Anyway, Thanks and Love from Sylhet, Bangladesh.

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад +1

      Thanks. This is not an appliction that would lend well to an oscilloscope. Other applications like DAC, or PWM would lend more to the use of an oscilloscope. Thank you for the suggestion and if you see where a timing would need an oscilloscope, let me know.

    • @Nabilphysics
      @Nabilphysics 2 года назад +1

      @@PatrickHoodDaniel Sure. Thanks for the reply.

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад

      @@Nabilphysics you're welcome!!

  • @gastonkitambala4358
    @gastonkitambala4358 Год назад +1

    Hello, this is amazing, I enjoyed doing this. However, when I imported the variable testCount in the STM studio I coundn't see anything displayed, what could be wrong?

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  Год назад +1

      The first thing that comes to mind is if you are using the correct elf file. You can try changing the variable name and see if the variable name changes in the monitor.

    • @gastonkitambala4358
      @gastonkitambala4358 Год назад +1

      @@PatrickHoodDaniel Thank you, it worked after I changed the zoom on the curve. However, I'd like to know where you did the division of the HSI clock value by 2 in order to multiply it by the PLL. Where does that division happen in the code? or how do you do it manually?

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  Год назад

      @@gastonkitambala4358 When you use the PLL, the division by 2 is done by the uC and is unavoidable. Watch at timestamp 6:45 where I show the division. There are ways to divide the clock if you wish to reduce the speed using prescalers which I talk about in that section of the video.

  • @mejoe444
    @mejoe444 2 года назад +1

    Please do more with HAL. HAL documentation is horrible and lacking examples. But great library to build projects. There are already many videos tutorials on low level. I hope you also teach with HAL. Btw part of HAL is actually low level wrapper for the uC peripherals and the other part accesses processor through CMSIS.

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад

      All of the videos in this series will be both HAL (or autogenerated) and register level code, so everyone has an option. There will be videos that I will only show register level because there will not be an option for HAL. After all, I will be creating features that the MCU will not be able to perform with HAL, like creating a PWM signal when all of the existing PWMs have been exhausted by bit-banging IO pins.

  • @GurpreetSingh-ew7ym
    @GurpreetSingh-ew7ym 3 месяца назад +1

    Please change video quality to full hd

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  3 месяца назад

      Thanks. I just looked at this video and the settings have up to 4k. Is there something I'm missing? I looked in the video settings and there is no parameter that sets the default settings. It is possible that when you were watching my video, RUclips set the video at a lower setting to be able to provide smooth video streaming due to other factors such as internet speed, throttling, network issues, etc. Let me know if there is something specific I can try. Thanks.

  • @varunkoganti9067
    @varunkoganti9067 2 года назад +2

    I said this on last video, saying it again. Explaining low level is not worth it. Just show users how to use the STM32 HAL & CubeMX+CubeIDE.
    not worth spending this much time on low level. Higher level APIs are worth it.
    Note - not saying this to irritate the author. imo this is great contet if you want to learn LL l, but in reality you use high level API. Like HAL for STM32.

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад

      You are not irritating me. Changing bits in registers is totally worth doing. Keep watching and find out. Please keep posting these comments. I enjoy reading comments no matter the provocative nature. It is important to understand all sides, but you don't really give me a reason why teaching low level is not worth it. Can you elaborate a little?

    • @varunkoganti9067
      @varunkoganti9067 2 года назад +1

      @@PatrickHoodDaniel been there done that. Which is why I am bored :)
      Heck I made my own bread board computer using discrete logic.

    • @PatrickHoodDaniel
      @PatrickHoodDaniel  2 года назад

      @@varunkoganti9067 Congratulations! I would love to see your work. But you didn't elaborate on why you feel low level is not worth doing. Can you explain to me your rationale? I want to keep this discussion going.

    • @varunkoganti9067
      @varunkoganti9067 2 года назад +1

      @@PatrickHoodDaniel low level is not worth doing - yes. But low level is worth exploring. It is fun but when you work on a project using HAL/APIs delivers results faster.
      HAL is just easier to understand and faster to work with. For example CubeIDE does everything for user. He can just work on high level application. Saving time.
      If you want to learn low level better ways to do are using 8051 or a 6502. 6502 will teach you the bare basics. What op codes are what pointers in C refer to. How the processor does stuff.

    • @varunkoganti9067
      @varunkoganti9067 2 года назад +1

      @@PatrickHoodDaniel i fixate on end result. I like custom PCBs over standalone boards.
      I change and do waste a lot of time with the layout just so it can be " perfect " and i make my compromise with LL code.
      Simply put use code that is efficient and works and is also open source.
      Above is my reason.
      2) take Arduino for example. It's HAL and it's easier to learn. Easier to work. And results in faster prototypes. Saves time and effort.