Luis Cruz
Luis Cruz

Reputation: 1644

Disabling UART0 for console output and use it for general-purpose on pocketbeagle

I am using a debian image running on the pocketbeagle (the smaller version of the beaglebone). I can't seem to figure out how to disable the UART0 for console debugging and use it for my own purposes.

When I type:

dmesg | grep tty

I get the following:

[    0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet
[    0.002567] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[    1.446237] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 158, base_baud = 3000000) is a 8250
[    1.459149] console [ttyS0] enabled
[    1.460177] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 159, base_baud = 3000000) is a 8250
[    1.461029] 48024000.serial: ttyS2 at MMIO 0x48024000 (irq = 160, base_baud = 3000000) is a 8250
[    1.462034] 481a8000.serial: ttyS4 at MMIO 0x481a8000 (irq = 161, base_baud = 3000000) is a 8250

I have tried looking at the uEnv.txt file in /boot but there's nothing related to UART0. This is what I found in uEnv.txt:

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

    uname_r=4.9.82-ti-r102
    #uuid=
    #dtb=


    ###U-Boot Overlays###
    ###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
    ###Master Enable
    enable_uboot_overlays=1
    ###
    ###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.4.x-ti kernel)
    #uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
    ###pru_uio (4.4.x-ti, 4.14.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 quiet

    #In the event of edid real failures, uncomment this next line:
    #cmdline=coherent_pool=1M net.ifnames=0 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

What should I do to use the UART0 on my pocketbeagle? I can't seem to find any documentation about it whatsoever.

Upvotes: 1

Views: 2274

Answers (1)

user7275233
user7275233

Reputation: 45

I don't think you will find a good answer by looking in the bootloader, device tree, or kernel. I think the ideal way to solve this problem is by configuring the operating system.

I did this with a pocketbeagle using debian 9.9, which uses systemd. It turns out that two systemd services interfere with uart0: [email protected] and [email protected]. systemd lets you force disable a service using mask. This only has to be done once.

So systemctl mask [email protected] and systemctl mask [email protected] should do it. Note that before using ttyO0 you may have to manually configure a serial port. I did it with a c program and a library called termios, but there's probably a way to do it on the command line.

To verify my answer, you can investigate the /etc/systemd/system directory and run systemctl list-units --type=service to see what's running on your system. For more information about systemctl look here:

https://www.tecmint.com/list-all-running-services-under-systemd-in-linux/

Upvotes: 1

Related Questions