UART over USB for Raspberry Pi

Out of the box connecting the RVR to a Raspberry Pi requires connecting both the USB cable (for power) and the UART pins to the Pi’s GPIO for communication. Communication over USB is possible, however, since the RVR is able to communicate with Arduino Unos with just the USB cable.

What hardware would I need to power and communicate with a Raspberry Pi with just a USB cable?

AFAICT Arduino Unos use custom firmware on an ATmega8U2 for converting the usual 2 wire TXD, RXD <> USB’s D+, D- (No idea what protocol is used on the USB side. Is there some standard?). Is there a standalone board that provides this functionality? Or will any FTDI/CP210x/PL2303 board work? Maybe Adafruit’s PiUART https://www.adafruit.com/product/3589 ?

For context, I have a Picon Zero “HAT” (https://4tronix.co.uk/blog/?p=1224) that doesn’t expose the Pi’s UART pins so I’m looking for alternatives. Currently I’m stacking it on top of a Perma-proto HAT to get access to those pins, but it would be nice not to have to plug in two cables at all.

Super-long term it would be neat to create my own PCB based on the Picon Zero (without the motor driver stuff) that includes this ability (single USB for power & UART).

2 Likes

Hello @c13,

As far as I understand, it is not possible for any device to communicate with the Rapsberry Pi through the USB power port. The data pins on that port are disconnected.

RVR is capable of communicating with Arduino through the USB, but we have not tried it with the Raspberry Pi. There might be a way to design a cable that splits the USB pins to 2 USB ports, but we cannot recommend you do that as you risk damaging both the RVR and the Raspberry Pi.

I hope this helps,

Quentin

1 Like

Correct, any solution would not be able to use the USB port on the Pi itself. My request was for recommendations for additional hardware (a HAT or something) with its own USB port that would provide power to the Pi via the 5v GPIO pins as well as provide UART to pins 14 and 15. I’ll probably give the mentioned Adafruit PiUART a try, especially since it’s open source and so could be integrated into a custom PCB.

1 Like

@c13 It looks like the PiUART uses a CP2104 for the USB interface. That is not tested with RVR, but may work if our USB stack happens to already support it. I’ve actually got a CP2102* breakout on order for internal testing, but if you beat me to it, please let us know your findings. Currently, we have only verified Arduino Uno and Micro:bit for USB to serial functionality.

Jim

*Edit: I originally stated I’ll be testing CP2104, it’s actually a CP2102, which is at least similar.

1 Like

Did your CP2102 arrive and were you able to check whether it works with RVR? I decided to hold off buying one myself to see if yours works first :slight_smile:

Hi @c13, sorry for the delay in getting back to you, this task had gotten deprioritized in the backlog. I just tried the CP2102 and it did not work. It seems that the CP2102, like FTDI USB-serial converters, requires a custom driver. The ATMega16U2 USB-serial implementation found on some Arduino boards, by contrast, uses a standard USB CDC implementation and works by default with our USB stack.

Atmel has an app note with example code about using ATMega USB MCUs to implement USB-serial interfaces. A small native-USB Arduino or other breakout board could be a useful platform for trying this out. I’d personally like to find or develop a really tiny USB-serial board that is RVR-compatible, but won’t have the time in the foreseeable future.
https://www.microchip.com/wwwAppNotes/AppNotes.aspx?appnote=en591204

A completely off-the-shelf solution would be something like this: https://store.arduino.cc/usa/arduino-usb-2-serial-micro, but unfortunately it’s retired.

If you’re just looking for something that’ll work in a pinch, you could take an Arduino Uno, run a jumper from GND to RESET to hold the ATMega328P in reset, and then connect the Pi UART to the Uno UART pins (TX to TX, RX to RX). You would also need to use level shifting, since the Pi UART operates at 3.3V and the Uno UART operates at 5V. I’ve used this approach to connect a Sparkfun Redboard to a RVR.

-Jim