My team is currently working on getting a new on-board computer for vision tracking working with our robot. We wanted to get two way communication between both the rio and the on-board computer. The obvious choice for us was serial communication. We are currently using robo-realm vision tracking which conveniently has a built in serial output. Also we want to stay far away from Network tables because it does not work as consistently as we would like, and we want to save the extra Ethernet port on the bridge.
We currently have
- A USB to UART cable from adafruit (https://www.adafruit.com/product/954)
- turned off console out in the robo rio
- have the baud rate from the on-board computer the same as the baud rate on the rio
- have the Tx and the Rx ports swapped for communication between the two
The issues we are currently having is that when we try to read the serial in the robot we get strange mix of characters that always starts with @. and never seems to match up with the output from the on-board computer.
So overall my question is how to read the info coming into the RS-232 port on the Robo-Rio ?
Why not communicate over ethernet? RoboRealm’s network tables module is designed for this
To answer the original question, the AdaFruit cable you linked is meant for TTL level signals, whereas the RS-232 port uses much higher voltages. The RoboRIO does have a TTL UART port, but it’s in the MXP port (pins 10 and 14, see the user manual).
You could use a RS-232 to TTL adapter board based on the MAX3232 chip (most are), like this one: https://www.amazon.com/Mini-RS232-Converter-Adapter-Transfer/dp/B01DAR1ZOY/ref=sr_1_2?ie=UTF8&qid=1470662535&sr=8-2&keywords=max3232
We chose this one because it has solderable pads, so we didn’t have to connect to the pins of a serial connector. It’s reasonably easy to code with in C++. I don’t know about coding it in Java, but it should be similar.
When we purchased this cable I made sure that it would be comparable with the 3.3 CMOS logic of the roborio.
On adafruits website they have a quick note on it saying “Note that we call this a “TTL cable” (since that’s what they’re called) but technically it’s CMOS logic.”
The Rio runs RS-232 at ±12 Volts (approx), while TTL is ±3.3 or 5. A 3.3V signal isn’t enough to trigger a RS-232 circuit.
You might try inverting the signal. I have found when converting from TTL to RS-232 this is needed. It just depends on your hardware.
You could use a USB to Ethernet adapter on the RoboRIO and connect over Ethernet that way.
Or just use the second ethernet port on the radio
OP wants to avoid using that.