[Beaglebone Black] Enable On-Board Serial UART

In order to use the built-in UART pins on the Beaglebone Black, we must first activate it.

The device name and pins is as follow:
Credit – http://beaglebone.cameon.net/home/serial-ports-uart

 RX  TX  CTS  RTS  Device  Remark
 UART0  J1_4  J1_5  /dev/ttyO0 BeagleBone Black only
 UART1  P9_26  P9_24  P9_20  P9_19  /dev/ttyO1
 UART2  P9_22  P9_21  P8_37  P8_38  /dev/ttyO2
 UART3  P9_42  P8_36  P8_34  /dev/ttyO3  TX only
 UART4  P9_11  P9_13  P8_35  P8_33  /dev/ttyO4
 UART5  P8_38  P8_37  P8_31  P8_32  /dev/ttyO5

Though the instructions in that site don’t work for me. I have to use the instructions from Logic Supply, basically activating the ports in the Device Tree.

// Change to Root
sudo su

// Activate UART1
echo BB-UART1 > /sys/devices/bone_capemgr.*/slots

// Activate UART2
echo BB-UART2 > /sys/devices/bone_capemgr.*/slots

To check if this is correct, type in the following:

nano /sys/devices/bone_capemgr.*/slots

and you should get something like this:

 0: 54:PF---
 1: 55:PF---
 2: 56:PF---
 3: 57:PF---
 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
 7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART2
10: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART1

Then to verify that the port are really enabled:

//Note that that is a O as of October
dmesg | grep ttyO

This show Serial UART port 0, 1 and 2 are enabled:

[    0.000000] Kernel command line: console=tty0 console=ttyO0,115200n8 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fixrtc quiet init=/lib/systemd/systemd
[    0.534994] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 72) is a OMAP UART0
[    0.546870] console [ttyO0] enabled
[  332.206455] 48024000.serial: ttyO2 at MMIO 0x48024000 (irq = 74) is a OMAP UART2
[  373.122405] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 73) is a OMAP UART1

* Note* UART3 actually don’t work using BB-UART3, because the device tree file don’t exist there. The device tree files are actually located at /lib/firmware/. Therefore to use UART3 we must copy a device tree file in that folder and use it. This site got the files available, UART3 is in the comment. Or here’s the direct link UART3 Device Tree File.

Then use the following command to enable UART3:

echo ttyO3_armhf.com > /sys/devices/bone_capemgr*/slots

The downside to this whole thing is that we have to repeat this process every time we boot, so it’s probably a good idea to do some kind of auto setup, though I tried, script wouldn’t work.

BeagleBone Black Setup Series

Advertisements

6 thoughts on “[Beaglebone Black] Enable On-Board Serial UART

  1. Pingback: [BeagleBone Black] Enable USB Internet Sharing from Windows | Billwaa's Blog

  2. Pingback: [BeagleBone Black] Expand File System Capacity on the MicroSD | Billwaa's Blog

  3. Pingback: [BeagleBone Black] Boot Debian OS from Image | Billwaa's Blog

  4. Pingback: [BeagleBone Black] Enable All UART Ports at Boot | Billwaa's Blog

  5. Thank you, your article was very helpful. I was having trouble getting UART4 going on the BBB kernel 4.1 following this article http://beaglebone.cameon.net/home/serial-ports-uart

    The trick was to read the comments in uEnv.txt more closely!

    Changing the uEnv.txt directive from: ‘capemgr.enable_partno=BB-UART4’ to:
    ‘cape_enable=bone_capemgr.enable_partno=BB-UART4’ now enables ttyS4 (aka ttyO4) at boot without having to manually echo BB-UART4 to slots. Yus!

  6. Pingback: UART en el Beaglebone Black | commsmusings

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s