2018-12-14

So on a BeagleBone Black running Linux, how can one tell if a device is enabled.  Lets say we’re trying to get UART2 and UART4 to work.  Those are both serial ports.  How can one tell if the serial ports are enabled (or just a singular – serial port)?  Well because we pretend to be familiar with Linux we do a ‘dmesg’ and look for a serial something of some sorts, yes?  That sounds reasonable.

NOTE: SPOILER ALERT: In order to limit the endless rambling and innuendo I have captured the ‘before serial port is working’ and ‘after serial port is working’ kernel logs (dmesg output).  So this is a replay of things that have already happened.  But I guess that’s pretty much all life given that human perceptual delay is approximately 200 milliseconds.

MOVING ON

So, before the serial ports are working:

root@beaglebone:~/dmesg# cat msg.noo | grep -i "uart\|serial\|tty\|anylittlehint"
[    0.000000] Kernel command line: console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0
[    0.002507] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[    1.147894] Serial: 8250/16550 driver, 6 ports, IRQ sharing disabled
[    1.151740] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a 8250
[    2.001622] console [ttyS0] enabled
[    2.006385] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 31, base_baud = 3000000) is a 8250
[    2.016257] 48024000.serial: ttyS2 at MMIO 0x48024000 (irq = 32, base_baud = 3000000) is a 8250
[    2.026199] 481a6000.serial: ttyS3 at MMIO 0x481a6000 (irq = 33, base_baud = 3000000) is a 8250
[    2.036056] 481a8000.serial: ttyS4 at MMIO 0x481a8000 (irq = 34, base_baud = 3000000) is a 8250
[    2.045992] 481aa000.serial: ttyS5 at MMIO 0x481aa000 (irq = 35, base_baud = 3000000) is a 8250
[    2.619047] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.637485] usb usb1: SerialNumber: musb-hdrc.1

After the serial ports are working:

root@beaglebone:~/dmesg# cat msg.woo | grep -i "uart\|serial\|tty\|anylittlehint"
[    0.000000] Kernel command line: console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0
[    0.002499] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[    1.147986] Serial: 8250/16550 driver, 6 ports, IRQ sharing disabled
[    1.151777] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a 8250
[    2.001681] console [ttyS0] enabled
[    2.006427] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 31, base_baud = 3000000) is a 8250
[    2.016404] 48024000.serial: ttyS2 at MMIO 0x48024000 (irq = 32, base_baud = 3000000) is a 8250
[    2.026376] 481a6000.serial: ttyS3 at MMIO 0x481a6000 (irq = 33, base_baud = 3000000) is a 8250
[    2.036216] 481a8000.serial: ttyS4 at MMIO 0x481a8000 (irq = 34, base_baud = 3000000) is a 8250
[    2.046145] 481aa000.serial: ttyS5 at MMIO 0x481aa000 (irq = 35, base_baud = 3000000) is a 8250
[    2.618839] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.637274] usb usb1: SerialNumber: musb-hdrc.1
[    3.047499] pinctrl-single 44e10800.pinmux: pin PIN48 already requested by 48024000.serial; cannot claim for 0-0070

If to you those look basically the same you win the ‘Normal Person’ gold-star.  Because here is the kicker, there is nothing between those two log snippets that indicates that a serial port has been enabled and is functional.

And yet UART2 and UART4 have been enabled by adding the following to the /boot/uEnv.txt file:

uboot_overlay_addr0=/lib/firmware/BB-UART2-RTSCTS-00A0.dtbo
uboot_overlay_addr1=/lib/firmware/BB-UART4-RTSCTS-00A0.dtbo

Super duper obvious and well documented.  But it works.  I can see the output on the TX pin on the scope .  Next step is to update the firmware on the board to recognize the enable pin and turn on the RS232 switch.

P.S.

I think I’m seeing my life-calling developing – computer systems that make sense.

 

 

Leave a Reply