Write a UART driver (Polling and Interrupt) | Embedded System Project Series #18

Sdílet
Vložit
  • čas přidán 29. 06. 2024
  • I explain what UART is and show how I use it to print text from my microcontroller to my desktop computer. I first implement a UART driver based on polling and then improve on it by making it interrupt-driven with a ring buffer. This driver will serve as the foundation for when I implement log tracing (printf) in my next video.
    0:00 Goal
    0:50 Outline
    2:30 What is UART?
    4:25 RS232
    5:43 Why UART?
    6:48 USB-to-UART bridge
    8:42 Implement polling driver
    10:45 Start, data, parity, stop bits
    11:50 New project
    15:40 Initialize UART peripheral
    20:15 Compile
    25:46 UART send function
    27:35 Print to terminal
    30:15 Interrupt + Ring buffer
    36:00 Implement ring buffer
    40:40 Implement interrupt driver
    49:00 Verify interrupt driver
    51:40 Move to robot project
    53:15 Commit
    #embeddedsystems #cprogramming #microcontroller
    🌍 Links related to this video
    code - github.com/artfulbytes/nsumo_...
    circular buffer - en.wikipedia.org/wiki/Circula...
    circular buffer - embeddedartistry.com/blog/201...
    datasheet - www.ti.com/lit/ug/slau144k/sl...
    🌍 Find me here
    GitHub - github.com/artfulbytes
    Instagram - / artfulbytescom
    Website - www.artfulbytes.com
    👨‍💻 About me
    Hi and welcome. I'm Niklas, an embedded systems engineer from Sweden. On this channel, I make practical videos about embedded systems or, in general terms, about building and programming hardware.
  • Věda a technologie

Komentáře • 25

  • @KuraldGalain
    @KuraldGalain Před 8 měsíci +4

    Finally some more indepth content with asserts and WITHOUT HAL, thank you!

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

    Thanks for Technical information for future and development.

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

    Hi This video is very informative and is very much helpful in understanding the concepts .

  • @alphaomega6023
    @alphaomega6023 Před rokem +5

    As a EE student who's trying to get more into the "hobbyist" side of electronics, this channel is gold. Keep it up! There isn't much good content out there about embedded systems on YT.

    • @artfulbytes
      @artfulbytes  Před rokem +3

      Great to hear, this video series is software heavy but I plan on also doing more electronics later :)

  • @michaelnilan7413
    @michaelnilan7413 Před rokem

    Great stuff. Keep it up!! Thank you for your efforts.

  • @olivialinden8699
    @olivialinden8699 Před rokem

    Great video 👍

  • @ramankumargautam1122
    @ramankumargautam1122 Před rokem

    Your content is hit, you would definitely be one of the most sought-after channel on embedded system, I would urge you to put more frequent videos and slow down a bit if you could, Thanks for such amazing content

    • @artfulbytes
      @artfulbytes  Před rokem +1

      Thanks! When you say slow down, you mean talk slower?

    • @ramankumargautam1122
      @ramankumargautam1122 Před rokem +1

      ​@@artfulbytes Thanks for replying, Ya I meant that you can talk a little slow

  • @MariusHeier1
    @MariusHeier1 Před rokem

    Great video. Subscribed! 👊🙂

  • @aryangupta4252
    @aryangupta4252 Před rokem

    You content it true gold and it must be preserved, but some things are hard to understand, my be one day you will make another series for the absolute beginners who is in transition from an Arduino.

    • @artfulbytes
      @artfulbytes  Před rokem

      Thank you! I will keep that in mind when I'm done with this video series :)

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

    Do you ever work with PIC microcontrllers? I like what you are doing but I need to get my head around understanding it for PICs.

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

      I haven't worked with PIC even though it's still heavily used in the industry. From what I've heard, the software ecosystem around PIC is quite bad, so I try to stay away. Anyway, microcontrollers fundamentally work the same way so the workflow I explain here also applies to PICs even if the peripherals and registers obviously are different.

  • @NotSionnix
    @NotSionnix Před 16 dny

    Hi, what is the model number of that USB to UART chip you used in the video and would it work on other Texas MCUs like the TIVAC123G?

    • @artfulbytes
      @artfulbytes  Před 12 dny +1

      CP2102 USB to TTL Converter HW-598, yes it should work on those.

    • @NotSionnix
      @NotSionnix Před 11 dny

      @@artfulbytes thanks for the reply! I got confused on which converter to buy and I will try this one. Also, do you have any suggestions for alternative motors that would work with your PCB?
      I've been checking the motors linked in your second video but they've been out of stock for a while now

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

    JFYI for noobies like me, the Tx pin of MSP430 to be connected to Rx pin of USB-to-UART converter chip.

  • @artfulbytes
    @artfulbytes  Před rokem

    Mistake: '
    ' and '
    ' should be in opposite order. I fix it in this video: czcams.com/video/K7eHkij-wNY/video.html.

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

    What name is microcontroller?

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

      MSP430G2553, MSP-EXP430G2ET Development kit