using UART on beaglebone black

Hello,

I would like to use the UARTs on beaglebone black or at least one of them. I found a big variety of information concerning this topic. Unfortunately many of it seems quite outdated.

  • the hardware is supported by the Kernel via device-tree and more specific functions by overlays
  • i found instructions to build own device trees
  • pins must be configured by config-pin?
  • Sometimes the resulting devices are called /dev/ttyOx, sometimes /dev/ttySx
  • i found information that dt overlays are managed by uboot instead of the kernel itself now
  • there is a library (adafruit) for using the uarts in python. But it has something to do with devicetrees too?
  • could it be that the ttyOx devices are related to the adafruit library?

Im using the am335x-debian-11.7-iot-armhf-2023-09-02-4gb.img.xz image.

What is the prefered way to use the uarts today?

My conclusion was that it should be enough to append

uboot_overlay_addr4=BB-UART2-00A0.dtbo

to /boot/uEnv.txt. Indeed i found the following message while booting:

uboot_overlays: loading /boot/dtbs/5.10.168-ti-r71/overlays/BB-UART2-00A0.dtbo ...
1017 bytes read in 4 ms (248 KiB/s)

So i expected to be able to use /dev/ttyS2.
But it isn’t.

Ok, i have done some investigation in the meantime.

First of all i have to apologize for bothering you: I’ve made an error in counting port pins :-).

But i will summarize my findings. Maybe somebody can confirm this though.

  • ttyOx is related to adafruit python library which is superfluous and need not to be used any more.
  • the kernel always initializes the uart hardware which is tied to ttySx device files. (/dev/ttySx can be opened even if not used by overlay or config-pin)
  • the “other side” of the uart hardware can be tied to io pins either with config-pin or uboot_overlay. (both is equivalent)
  • building own device trees is unnecessary

So the only thing that must be done to use the uarts is in uEnv.txt (example for uart2):

uboot_overlay_addr4=BB-UART2-00A0.dtbo

Depending on your image and kernel, no. Depending on your image and kernel, yes.

With the newer builds made by beagleboard.org, I have noticed that the UART pins are now populated in a directory called /dev/bone/.

Seth

Hm, in /dev/bone i can only find symbolic links to the device files (ttySx).

Do they work? Try 'em out!