curlysue48
curlysue48

Reputation: 41

Enabling UART on Beaglebone Black

I'm having trouble getting UART enabled. I've gone through many different directions on how to enable and troubleshoot from updating the uEnv.txt file to updating the kernel. I've come to conclude that it may be an issue with using a different kernel than the instructions, but I'm not sure? I don't know very much about the Beaglebone and I'm still learning. Whenever I try to test UART by using Python and typing the following:

import Adafruit_BBIO.UART as UART

UART.setup("UART1")

I get the error: File "stdin", line 1, in module

RuntimeError: Unable to export UART channel.

I'm also starting to worry that I simply don't have capemgr. When I run the command :

ls sys/devices

I don't have capemgr listed.

I'm using the latest Debian Image : Jessie Debian 8.3 (2016-01-24)

the Kernel version I'm running is 4.1.17-ti-rt-r46.

and my DTC version is 1.4.1-g1e75ebc9

I would really appreciate any help. I've been wrestling with this issue for a few days now. Thank you!

Upvotes: 4

Views: 27128

Answers (4)

Pe Dro
Pe Dro

Reputation: 3043

I already answered this HERE, but let me re-post it:

I can vouch for Debian 10 using this method:

I was able to enable all 4.5 UARTs automatically on boot-up. Unlike Debian 9 and older versions, the uEnv.txt is present in /boot/.

  1. Back up this file.

  2. Edit this file using sudo privileges:

$ sudo nano uEnv.txt

The final version for enabling all the 4.5 UARTs should look as follows:

#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.19.94-ti-r42
#uuid=
#dtb=

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
# UART 1
uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo
# UART 2
uboot_overlay_addr1=/lib/firmware/BB-UART2-00A0.dtbo
# UART 4
uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo
# UART 5
uboot_overlay_addr3=/lib/firmware/BB-UART5-00A0.dtbo
# UART 3 (only TX). Note that in "uboot_overlay_addrX", the X need not be = UART id
uboot_overlay_addr4=/lib/firmware/BB-UART3-00A0.dtbo

###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768@60e

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

#cape_enable=capemgr.enable_partno=BB-UART1,BB-UART2,BB-UART4,BB-UART5

  1. Save and reboot. Enjoy !

Upvotes: 2

Serg Stetsuk
Serg Stetsuk

Reputation: 429

You can change /boot/uEnv.txt First of all enable UARTS:

cape_disable=bone_capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
cape_enable=bone_capemgr.enable_partno=BB-UART1,BB-UART2,BB-UART4,BB-UART5

Then don't forget to configure pinmux with appropriate dtbo's:

###Overide capes with eeprom
uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo
uboot_overlay_addr1=/lib/firmware/BB-UART2-00A0.dtbo
uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo
uboot_overlay_addr3=/lib/firmware/BB-UART5-00A0.dtbo

Upvotes: 2

acs
acs

Reputation: 836

You need to check if the UART pins you are using are being used for other purposes. For this you need to look at the pin diagram first. If there is a conflict, you have to give up things like EMMc or hdmi and you need to make these pins possible. First disable the conflicting configurations in uEnv.txt. Then you can activate the pins as follows.

    #! /bin/sh cd /sys/devices/platform/bone_capemgr File=slots if grep -q "Override Board Name,00A0,Override Manuf,univ-emmc" "$File";  then    
    cd
    echo "\n Pin configuration available"
    echo "\n UART 4 configuration p9.11 and p9.13"
    sudo config-pin P9.11 uart
    sudo config-pin -q P9.11
    sudo config-pin P9.13 uart
    sudo config-pin -q P9.13
    echo "\n UART 1 configuration p9.26 and p9.24"
    sudo config-pin P9.24 uart
    sudo config-pin -q P9.24
    sudo config-pin P9.26 uart
    sudo config-pin -q P9.26
    echo "\n UART 5 configuration p8.38 and p8.37"
    sudo config-pin P8.38 uart
    sudo config-pin -q P8.38
    sudo config-pin P8.37 uart
    sudo config-pin -q P8.37
    echo "\n UART configuration end"  else    
    echo "Oops!!configuration is not available"
    echo "Please check uEnv.txt file and only disable HDMI" fi

Upvotes: 1

Timothy Vann
Timothy Vann

Reputation: 2677

Apparently the powers that be like to change files to keep us on our toes.

TamusJRoyce left a comment here: http://www.thing-printer.com/cape-manager-is-back-baby/ that helped me:

/media/BEAGLEBONE/env.txt and /boot/uBoot/uEnv.txt has moved to /etc/default/capemgr (file which may not exist). It also has a new syntax. Add "CAPE=BB-SPI-01,BB-UART1,BB-UART2,BB-UART4" to get main ports working. Then reboot.

To enable UART1 and UART2 on Beaglebone Black Running Debian 8

  • Step 1: sudo nano /etc/default/capemgr
  • Step 2: Change #CAPE= to: CAPE=BB-UART1,BB-UART2
  • Step 3: reboot
  • Step 4: ls /dev/ttyO*
  • result: /dev/ttyO0 /dev/ttyO1 /dev/ttyO2

Upvotes: 11

Related Questions