Adafruit serial UART library seems to have wrong tty names

I am trying to use the Adafruit Python IO library to acces the UARTS
on my BBB.

According to the Adafruit documentation if I do:-

    import Adafruit_BBIO.UART as UART
    UART.setup("UART1")

I should then be able to use /dev/tty01, but there isn't a /dev/tty01,
only a /dev/tty1. Is this an error in the documentation or is there
something more fundamental broken? I don't seem to be having much
success using /dev/tty1 or /dev/tty01 anyway.

Sounds like you didn't load the ttyO1 overlay..

Then /dev/ttyO1 will be available.

Regards,

Could you explain that more simply please!?

I have since discovered that some serial ports work for me and others
don't, even though *none* of them actually appear to an ls command.

If I simply do the following in my python program:-

    import Adafruit_BBIO.UART as UART
    import serial

    UART.setup("UART1")

    ser = serial.Serial(port = "/dev/ttyO1", baudrate=9600)

Then it works for UART1, UART2 and UART4 but *doesn't* work for UART3
and UART5. That's 'works' as in I can write things to the serial port
and it get sent to a remote system, I still can't see the named
/dev/tty0x device.

I'd expected the Adafruit library to do all that's necessary to make
the port work and be visible.

I strongly recommend that you read Adafruit’s guide regarding the BBB’s device tree overlay. It really help me put this all together: https://learn.adafruit.com/introduction-to-the-beaglebone-black-device-tree/overview

You will find there why and how to modify your uEnv.txt file in order to enable ttyO1. In mine, the last line looks like this:


optargs=coherent_pool=1M; capemgr.enable_partno=BB-UART1,BB-SPIDEV0

optargs=coherent_pool=1M; capemgr.enable_partno=BB-UART1,BB-SPIDEV0
optargs=coherent_pool=1M; capemgr.enable_partno=BB-UART1,BB-SPIDEV0
optargs=coherent_pool=1M; capemgr.enable_partno=BB-UART1,BB-SPIDEV0

Sorry that “optargs” line should only appear once…

The Adafruit UART IO documentation specifically says that it *does*
export the overlays:-

    The Adafruit IO Python library will export the UART device tree
    overlays as a convenience. There are five serial ports brought to
    the expansion headers (UART3 only has a single direction, TX), and
    one (UART0) with dedicated headers that aren't available to use in
    your Python programs.

... but not all the UARTs work.

In addition the use of the letter O in the device name is just silly! :slight_smile:

The devices it creates are called /dev/ttyO1, /dev/ttyO2, etc. with
the letter O. There's not a mention anywhere that it's a letter
rather than a digit and given the context it's second nature to assume
it's a zero. Still I did spot that eventually.

Sorry, I didn’t notice that Adafruit took care of exporting the overlays. Can’t help with UART3 and 5 not working, I’ve only used 0, 1 and 2 so far.

Michel

How do you use 0 (zero), that would suit me well as it uses the header
that's not part of P8 or P9.

Yes, the O and not zero threw me for a loop when I was first setting up serial on the BBB. I have no clue where/why that choice was made.

I haven't looked into the Adafruit library, my hunch here is that to use uart5 you will have to disable HDMI as the pins used for that uart are in the HDMI group. As noted above uart3 is TX only, and again those pins fall within the HDMI group.

For what it's worth I referenced that info from here.

https://github.com/derekmolloy/boneDeviceTree/blob/master/docs/BeagleboneBlackP8HeaderTable.pdf
https://github.com/derekmolloy/boneDeviceTree/blob/master/docs/BeagleboneBlackP9HeaderTable.pdf

Mike

> The devices it creates are called /dev/ttyO1, /dev/ttyO2, etc. with
> the letter O. There's not a mention anywhere that it's a letter
> rather than a digit and given the context it's second nature to assume
> it's a zero. Still I did spot that eventually.
>
Yes, the O and not zero threw me for a loop when I was first setting up
serial on the BBB. I have no clue where/why that choice was made.

I haven't looked into the Adafruit library, my hunch here is that to use
uart5 you will have to disable HDMI as the pins used for that uart are
in the HDMI group. As noted above uart3 is TX only, and again those
pins fall within the HDMI group.

I only need TX for the application I have in mind at the moment so
UART3 seemed the obvious choice initially.

For what it's worth I referenced that info from here.

https://github.com/derekmolloy/boneDeviceTree/blob/master/docs/BeagleboneBlackP8HeaderTable.pdf
https://github.com/derekmolloy/boneDeviceTree/blob/master/docs/BeagleboneBlackP9HeaderTable.pdf

Yes, I've just got there too! :slight_smile:

Information about which IO you can use 'out of the box' without
problems is thin on the ground IMHO.