Propeller HAT as a UART expander for RPi


#1

Are you still actively working on and supporting the Propeller HAT for the Raspberry Pi?

I think this HAT would lend itself nicely as a UART expander easily handling 7 ports. Each port would run in its own cog on the Propeller with cog 0 acting as the conduit to the RPi.

The Propeller has lots of RAM so could buffer a few kB per port making it easy for the RPi to wonder off and do other things and not have to worry about missing an incoming TX from a device.

I have been tinkering with these Propeller chips as a hobbyist for a few years but find myself wanting to get above its “bare metal” programming limitations especially when it comes to using it as a web server. Hence my interest in the RPi. I just ordered my first Pi but already am a bit stumped on how to go about hooking up my RS232 weather station and my Xbee RF module as both need UART and the RPi 3 has but one UART port. I would also like to add a few other devices that utilize UART for communication.

Do you think the Propeller HAT is a good choice for this or are there other HATs out there that already handle this UART expansion function?


#2

I think the common solution to needing to talk to multiple UART devices is just to use a USB->UART adapter like so: https://shop.pimoroni.com/products/usb-to-uart-serial-console-cable

It’s a totally boring and uninventive solution, but it works!

I haven’t come across any HATs that specifically multiplex the UART, even though it’s possible. I think the existence of the aforementioned USB adapters is probably the reason for this.

Propeller HAT could potentially do the trick. The lack of realtime (by default anyway) on the Pi makes the tight polling/timing required to get a functional soft UART quite tricky. On the Propeller HAT there’s no such problem. It might make a cool/useful example!

I haven’t written any more code or examples for a long time for Propeller HAT. I still love the Propeller, but it’s a case of finding the time! I tend to use it more often as a stand-in SID chip than for anything else :D


#3

I don’t know anything about programming the RPi yet so I am not sure how it reacts to incoming data in its UART RX buffer. It’s not even clear to me how big this buffer is (I saw some references to it being only 16 bytes but this seems way too small for a multitasking microcomputer).

My main interest in the RPi is using it as a web server for my weather station. Every 5 minutes it needs to query it for the latest data and then put these data into some type of data base. Seems like this should be a short Python script that gets run automatically every 5 minutes. If the script run a few seconds earlier or later won’t bring cries from the dozen or so neighbors that look at the web site once or twice a day!

So it then occurred to me that the RPi should also be able to run a few additional Python scripts to turn on and off various lights run off of some Xbee RF modules (mostly outdoor landscape lights that come on at dusk and off at some particular time at night). I will also be utilizing the RPi’s building WiFi and BLE to communicate with my iPhone.

I also heard there is some conflict between the WiFi, BLE and the UART, but I am uncertain if this interferes with the UART on the GPIO (are there two UARTs on the RPi3?).

I also do not know how to set up the RPi to be a server but then respond to incoming data on the UART and run some bit of code in response then go back to listening for web requests. My various Xbee RF devices will periodically query the RPi for bits of data like the current time, outside temperature, the chance of precipitation for the next 12 hours, etc.

I have a functioning system for all of this now using three Propellers and it takes a lot of low level programming to add new features and debug pooched code. The RPi with its higher level programming languages seems quite appealing now.

I will probably start with the weather station on the USB port and the Xbee RF device on the UART and see how it goes. When I add more UART devices I can revisit the Propeller HAT concept.

Thank you for the help!


#4

yes, using UART com on the RPI3 is a bit of a nightmare due to how the bluetooth hijacked the reliable bus.

even if you don’t have a Propeller HAT, you can run the installer referenced in its github and that will sort it out for you.

alternatively:

curl -sS https://get.pimoroni.com/uarton | sudo bash

… you will lose bluetooth however, but there is no real alternative (well, there is, but without knowing your way around the Pi you will likely struggle). this won’t affect WiFi however.