Thursday, May 23, 2013

uart1.dts: Configuration File to Enable UART1 on Beaglebone Black

Configuring the pins on the Beaglebone Black is different (more complex?) than the configuration process on the Beaglebone. The following configuration file and notes on its use are taken from the new book, Bad to the Bone: Crafting Electronic Systems with the Beaglebone and Beaglebone Black by Steven F Barrett and Jason Kridner (pp. 219-20).  This is also available from various places on the Web, but I'm posting it here for my own reference (and for use by anyone who finds it here).

I've made a couple changes in the steps described in the notes because of a difference in a directory name.

/* Copyright (C) 2013 CircuitCo
 * Copyright (C) 2013 Texas Instruments
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Genral Public License version 2 as
 * published by the Free Software Foundation.


/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    /* identification */
    part-number = "uart1";
    version = "00A0";

    fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            pinmux_serial1: pinmux_serial1_pins {
                pinctrl-single,pins = <
             0x184 0x20 /*P9_24(ZCZ ball D15) RX-enabled MODE 0*/
             0x180 0x20 /*P9_26(ZCZ ball D16) RX-enabled MODE 0*/
    fragment@1 {
        target = <&ocp>;
        __overlay__ {
    serial1_pinmux_helper {
        compatible = "bone-pinmux-helper";
        status     = "okay";
        pinctrl-names = "default";
            pinctrl-0 = <&pinmux_serial1>;
    fragment@2 {
        target = <&uart2>;   /* really uart1 */
        __overlay__ {
            status = "okay";

//uart1.cpp - configures BeagleBone uart1 for transmission and 9600 Baud
// and repeatedly sends the character G via uart1 tx pin (P9, 24)
// To configure the UART first do:
// # dtc -O dtb -o uart1-00A0.dtbo -b 0 -@ uart1.dts
// # cp uart1-00A0.dtbo /lib/firmware/uart1-00A0.dtbo
// # echo uart1 > /sys/devices/bone_capemgr.9/slots
// # Path for the command above may vary -
// # echo uart1 > /sys/devices/bone_capemgr.8/slots
//Check that the pinmux has been configured via:
// # cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
// pin 96 (44e10980): serial1_pinmiux_helper.14 (GPIO UNCLAIMED)
//function pinmux_serial1_pins group pinmux_serial1_pins
// pin 97 (44e10984): serial1_pinmux_helper.14 (GPIO UNCLAIMED)
//funcion pinmux_serial1_pins group pinmux_serial1_pins

Note (June 10, 2013):  After rebooting the Beaglebone Black, the echo command needs to be run again. Including a line like this in a Python script runs the echo command. You may need to adjust the path, as noted above.

os.system("echo uart1 > /sys/devices/bone_capemgr.9/slots")


  1. In recent versions of Ångström for BBB, in /lib/firmware is a lot of pre-compiled virtual capes. They can be enabled in /BEAGLEBONE/uEnv.txt (on the host computer) by adding entries to capemgr.enable_partno, i.e. capemgr.enable_partno=BB-UART2,BB-UART4