Can't get UART1 to work

I am trying to use UART1 on a BeagleBone Black and am not having much luck. As far as I can tell the UART is enabled by default. But when I cat and echo I don’t usually see anything. I’ve gotten it to work a couple times but I don’t remember what exactly what steps I took and it always crashes at some point and breaks cat so that it no longer stays open and just immediately exits.

Is there an up to date guide on how to get this to work? Everything I’ve seen online is either really old or implies what I am doing should work.

I made a python script which works the way I was hoping cat would. Now I can see my outputs from echo. I would still like to know why what I am doing does not work in the first place though.

ser = serial.Serial(port = "/dev/ttyO1", baudrate=9600)
    if ser.is_open:
1 Like


/dev/ttyS1 is the way.


P.S. So, instead of “/dev/ttyO1”, it is “/dev/ttyS1” where S is in place of O (not zero). O like oh was the old way.

Also, if you are not using .dtbo files in the /boot/uEnv.txt file, you can always use config-pin p9.NN uart on the UART1 pins to handle muxing the pins for UART communication.

I tried ttyS1 as well and it does not work as anticipated either. It appears to be interchangeable with ttyO1 when I use the Python script though.

If I configure the pins to uart with pin-config then cat reacts but just outputs infinite blank lines.

The python script will work after I either use pin-config or call Adafruit’s UART.setup('UART1') function. Regardless, any time after I run my python scrips, cat no longer works at all for /dev/ttyO1 or /dev/ttyS1.


Since you are using Python3, try to install the pyserial lib. to work w/ serial applications.

  1. sudo apt install python3-serial


  1. python3 -m pip install pyserial


  1. NOT both…

Installing both versions will ultimately doom your install of one or the other or both.


P.S. I will get to my board soon and test it out. Okay! I tested the board and…

I tried to use config-pin p9.24 uart && config-pin p9.26 uart and the files are available. I will try your source soon.

When I run your source after installing pyserial via python3 -m pip install pyserial under a venv and activating the virtual environment, I receive this output:


Hello @afewgoblins ,

Did you ever:

  1. Get your UART source to function properly?
  2. Get the BBB in question to handle the overlay or .dtbo?

What exact board are you using?


P.S. For instance, the BBB, BBG, and etc. all have similar aspects but are a bit different in pin consumption.

Your ouput from my source is correct. I’ve since updated my python program so it behaves more like I expected cat to do.

  1. My python scrips operates acceptably for now. I’ve only tested it with loopback and not with my final device yet. I got side tracked with some other stuff and might not be able to get back to it for a week now.
  2. I’ve found it very hard to understand what overlays or .dtbo files are applicable and how to use them All the documentation seems outdated or for different version. I’ve disabled HDMI/LCD via uEnv.txt but that is the only permanent modification I have made to the configuration.

I am using a BBB Version C.

This is the latest python script I am using to monitor the serial port:

import serial
from Adafruit_BBIO import UART
from time import sleep

ser = serial.Serial(port = "/dev/ttyO1", baudrate=9600)
        if ser.is_open:
            msg = str(ser.read_all(),'utf-8')
            if msg != '':
    except KeyboardInterrupt:


The .dtbo files in /boot/uEnv.txt are an older model of .dts compiled files that the BBB can use to distinguish different peripheral and pin muxing.


P.S. GitHub - beagleboard/BeagleBoard-DeviceTrees: Linux kernel device trees and device tree overlays for open hardware single board computers and add-on boards. is something the people put together regarding their boards being sold to consumers. I have found many of their examples and ideas to be very helpful. Really, just adding the .dtbo in the appropriate section(s) of u-boot_overlays in /boot/uEnv.txt does the trick. Actually, reading through those files is a good source of knowledge for building around the am335x too.

Oh! This branch from git is a bit updated!

I think this will be more valuable if you plan on updating the board to newer kernels and images within Bullseye. Also, mainlining the source into the kernel is a plan, I think, for the people and this entails having their builds for the am335x (along with the peripherals) into future builds of the kernel instead of altering them in userspace. Correct if I am wrong anyone! Feedback!

@afewgoblins ,

Also, I understand that you plan to take off for a bit. No issue at all. I will try to pay attention in case I see you need other support. Oh! The Adafruit_BBIO lib. may not work as expected on Bullseye w/ the updated kernels.

I have not completely figured out why b/c of so much change, which can be good, does this lib. have so many compiler errors when building for newer kernels and images.


P.S. I just wanted to update you in case you had planned on making the move to newer ideas but still wanted older functionality.

Thank you very much for the assistance.

I kind of wrote off overlays and device tree files early on. The github repository you linked has a three line readme, no mention of usage or even what a device tree is. The tutorials from Adafruit and the like all seem outdated or broken in some other way. It seemed overly complicated and potentially non-functional to spend a bunch of time learning about when all I wanted to do was turn on a UART which as far as I can tell is already present in the filesystem. Reading a bit more it seems device trees are Linux things, not Beaglebone things, which explains the lack of documentation I guess.

The first repo you linked (4.19) has a file called am335x-bone-pinmux-ttyS1.dtsi. This is promising, it looks lik it sets the P9.24 and P9.26 pins to UART1. This is what want, what I was trying to do manually and presumably what the Adafruit library does. However this file is gone from the 5.10 repo and with no readme included with the repo I have no idea where it went or what I am supposed to do. It all just seems way too complicated to do something as simple as enable a UART. It is extremely frustrating.

I don’t want to use Adafruit’s library. The Adafruit_BBIO.UART.setup('UART1') is the only function I am using and only because it seems to be the only way I can get UART1 to respond half-way correctly. I would much rather just configure the pins manually and do away with Adafruit’s library.

I am not terribly concerned about new ideas or old functionality. All I need is 14 GPIO, 1 UART, 1 I2C, and an Internet connection in a semi-stable platform. So far the only thing to give me trouble is the UART, which was the last one I was expecting to give me any issues.

I’ll be out of the country next week but I’ll bring a one of my Beaglebones and my UART device and see what I can accomplish.

1 Like

@afewgoblins ,

Hello again…I was out of ideas on Device-Trees a while back. Since then, I have been reading about the internal contents of these files.

  1. You can set up a bash script to handle config-pin and put the script in PATH or in a .service file for starting when booting.
  2. If you are using 4.19.x kernels w/ the older (outdated) image, use the /boot/uEnv.txt file to set up your overlays.
  3. If you are using a newer image from this forums sections on Bullseye or Buster w/ updated kernels, I am clueless right now. I need to test more. But, uboot-overlays still works, it seems, in /boot/uEnv.txt.

Although it is frustrating at times, using UART is not all that bad on these boards w/ pyserial. I never really learned how to accomplish tons of different methods in source for pyserial due to their lack of instruction.

Also, the 5.10.x-ti kernel seems to be the tester these days. By tester , I mean that they are trying to organize different aspects to their images to handle such delays or frustrations from users.

.bashrc in $HOME/ can have bash/shell script $PATH variables installed in it. For instance:


config-pin p9.24 uart && config-pin p9.26 uart

# Other configuration files and source or $PATH variables


/etc/systemd/system/ directory has a thing called .service files. If you want to have your source from .bashrc run on boot instead of sign in, use the .service files in the location of /etc/systemd/system/.

  1. .bashrc is for signing in and making the programs work on sign in
  2. .service files are used for programs that work on boot instead of a sign in


P.S. About that link to 4.19.x and 5.10.x kernels, you can change them and alter them to your need if you know how or you can build them as is w/ make in the BeagleBoard-DeviceTrees dir. and sudo make install will place them in a particular place in your file system for use.

But…things are getting or were getting mainlined in the kernel for use out-of-the-box. So, there may not be a reason to handle such a script in the future. We shall have to wait and see once things get altered and changed a bit.

Also, here is a short, instead of theory, on .bashrc: .