Close

Tangent: popular boards hate UART

A project log for Neato D-Series Lidar and Raspberry Pi 3A+ with ROS

Working towards an autonomous mech warfare robot. (2020)

gertlexGertlex 06/15/2020 at 04:381 Comment

I've probably mentioned this already, but just in case: my intention is to have the pyboard talking to the raspberry pi, and the raspberry pi listening to the lidar. But unfortunately for me, the raspberry pi only breaks out one hardware serial port to it's 40-odd pins! Lame.

For the record, this is why I never did anything with Arduino boards: they too have a single serial port, generally (or the second one uses the USB port... which I'd like to use for programming a given robot).  I guess the Raspberry Pi guys continue that tradition; perhaps it was a limitation of the original board, and maintaining backwards compatibility for RPi hats means we're stuck with that

Historically, I've used the Axon (Atmega 640) with 3 or 4 UARTs, the wixel with 2+ UARts, and then the pyboard, with 4 or 5 UARTs.  I caved and went the popular route of using a Raspberry Pi since it's not its own entire thing (yay Linux!) like Arduino kind of was, and because I happened to be doing some stuff with RPi 3B+ boards at work.

So, mainstream hackers are dumb and don't use UARTs enough, and the market gives us correspondingly dumb boards? Let's go with that ¯\_(ツ)_/¯. Rant over.

So, what am I to do? Well, there's a few options... here's how I ranked them before getting started:

  1. Try out "software" serial port options for the RPis
  2. Find a different "knockoff" RPi-like board that's better suited for my needs
  3. Finally heed a few people that have asked, regarding board-to-board communications, "why not just use I2C or SPI?" in the past, and learn something new... Nahhh.

So I dove into the software serial options.

First, there is a second UART on the Raspberry Pi boards, and by default it's used in conjunction with the onboard Bluetooth.  Pyboard doesn't have Bluetooth, and I like to avoid wireless whenever I can, especially in the RF-heavy environments we tend to do Mech Warfare in.

After a few hours of reading, I finally concluded that you can't just map this extra serial hardware to a set of the GPIO pins.  I'm not EE, but I want to believe the Raspberry Pi folks could have easily done this, but didn't. (I'm probably wrong... there is lots that I do not know.)

Somehow or the other, I ran across PiGPIO: http://abyz.me.uk/rpi/pigpio/index.html

It comes already installed with the Ubiquity Robotics image, with a daemon ready to run, too: pigpiod.

And lo, I was able to get this to work in quick prototyping.  But then I ran into a wall: To work with the XV11 ROS 1 package's node, my serial data has to be on a /dev/ttyXXX interface.  As best I can tell, there is no plug and play approach to doing this with pigpio.  There is /dev/pigpio, but it doesn't act like a TTY Serial port, not too surprisingly.

So... a quickly dug up option is the RockPi S board, which is pretty comparable to the Raspberry Pi 3A+.  It has 3 UARTs.  It doesn't have HDMI, which is interesting.  Sounds like an adventure!  Here's a comparison of the two boards: https://www.hackerboards.com/compare/359,301/ (I suspect that the RockPi S having HDMI audio, but no HDMI port, is likely an error)

So, I plan to eventually acquire the RockPi S, but first I should probably figure out how to make the laser reliable in continuous operation.

Discussions

Gertlex wrote 06/15/2020 at 04:42 point

I'm likely misremembering the situation with Arduinos and UARTs.  It might have been (back when I was working on the original Numa) a case of "there's 2 and I need 3 UARTs" that is the origin of my scorn.

  Are you sure? yes | no