Talk to Your Pico Over Serial | Raspberry Pi Pico UART Tutorial
In this video, we dive deep into how to use the serial port on the RP2040 Raspberry Pi Pico. Learn how to use the UART0 port on the Raspberry Pi Pico! Output data and parse user input to make your Pico projects more powerful. By being able to communicate with your Pi Pico, you are able to better debug your programs, or just make them generally more useful.
Buy the RP2040:
Code for this video is posted at
Subscribe for more videos like this! Thanks for watching!
===
i’ll be showing you how to write code to use serial input and output on the raspberry pi pico by the end of this video you’ll be able to write a program like this that lets you see the output from your pico as well as send it commands over serial to reset it enable and disable pins and more getting readable output from your code is an extremely important part of debugging without an idea of what state your program is in you might as well be trying to read the mind of your microcontroller which can be frustrating instead to communicate with the pico we’re going to use an ftdi rs232 cable like this one rs-232 is a physical layer protocol responsible for carrying the uart protocol or universal asynchronous receiving transmit we’re going to hook up our ftdi cable to the uart zero bus on our pico uart0 is the default bus used for standard input and output or standard io when we write code calls to functions like printf scanf etc use this bus the way we’re going to wire our ftdi cable to the pico is as follows the orange cable or host receive is going to go to pin 2 the yellow cable or host transmit is going to go to pin 1 and then finally the black cable for ground will go to pin 3. having a common ground between devices is extremely important without it it’s likely that your devices won’t be able to understand what the other one is saying so it’s important to not skip this step here you can see i have my pico wire the same way the ftdi cable is plugged into the uart zero bus for serial communications and the micro usb cable is plugged in so that i can program the device on my linux workstation when i plug in the ftdi usb cable it populates as dev tty usb0 to communicate with it we need to use a program able to open serial devices i use minicom to install it type sudo apt install minicom once it’s installed run sudo minicom capital d slash dev tty usb0 once inside minicom need to press control plus a then o to go to the options menu select serial port setup then press f and this disables hardware flow control so you can type to the pico alright now that we have the serial port hooked up let’s write some code by the way i’ll be posting all this code onto the channel’s github check the link in the description for that also i noticed that 90 of my viewers are not subscribed if you’re not subscribed right now do me a favor hit that sub button i’d really appreciate it step one we need to confirm that we can actually get output from the device remember like i said all standard output and input goes to the uart terminal we have hooked up so we can literally just type printf in our code and we in theory should get output to the terminal let’s try that real quick so first we need to
===
Теги: raspberry pi pico,raspberry pico uart,raspberry pi pico programming,raspberry pi,uart tutorial,rs232 tutorial,embedded programming tutorial