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.
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.
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!
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.
For what it's worth I referenced that info from here.
> 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.