Write a UART driver (Polling and Interrupt) | Embedded System Project Series #18
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
Finally some more indepth content with asserts and WITHOUT HAL, thank you!
Thanks for Technical information for future and development.
Hi This video is very informative and is very much helpful in understanding the concepts .
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.
Great to hear, this video series is software heavy but I plan on also doing more electronics later :)
Great stuff. Keep it up!! Thank you for your efforts.
Thanks!
Great video 👍
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
Thanks! When you say slow down, you mean talk slower?
@@artfulbytes Thanks for replying, Ya I meant that you can talk a little slow
Great video. Subscribed! 👊🙂
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.
Thank you! I will keep that in mind when I'm done with this video series :)
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.
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.
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?
CP2102 USB to TTL Converter HW-598, yes it should work on those.
@@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
JFYI for noobies like me, the Tx pin of MSP430 to be connected to Rx pin of USB-to-UART converter chip.
Classic
Mistake: '
' and '
' should be in opposite order. I fix it in this video: czcams.com/video/K7eHkij-wNY/video.html.
What name is microcontroller?
MSP430G2553, MSP-EXP430G2ET Development kit