Serial Port Data Transmission Issues

I am trying to get an arduino to communicate with the BeagleBone Black and send some measured sensor data over via the serial port. I am using the most recent version of node red to do this. I am running the latest version of Debian.

I have confirmed using an oscilloscope that the arduino’s serial port is outputting the information when it is supposed to (it’s triggered by an interrupt sent by the BBB). I can see the serial ports that are supposedly enabled in /dev and they appear as ttyO1, ttyO2, and ttyO4, and I have confirmed the port mapping and ruled out wiring issues as well (I’m using a logic level converter to go from the arduino’s 5V to the BBB’s 3.3V level).

The ports also appear to map like so:

lrwxrwxrwx 1 root root 5 Jun 9 22:37 ttyO1 → ttyS1
lrwxrwxrwx 1 root root 5 Jun 9 22:37 ttyO2 → ttyS2
lrwxrwxrwx 1 root root 5 Jun 9 22:37 ttyO4 → ttyS4

Node red also sees these ports and indicated that they are ‘connected’ which I assume means opened.

When I attempt to receive data on the BBB from ANY of these ports I am unable to see anything on the output in node red or from the command prompt.

I am using a baud rate of 300 to rule out timing issues. I have also confirmed that the arduino’s serial settings should be matched to what the BBB is expecting. Lastly, I have even tried sending simple strings from one serial port to the other on the BBB itself.

Has anyone here had this sort of issue and if so, how did you come to a solution?

TL;DR: When I attempt to receive data on the BBB from ANY of the UART ports I am unable to see anything on the output in node red or from the command prompt. Already ruled out the obvious issues, and the BBB clearly sees the ports. What could be the issue here?

json source from nodered:

[{“id”:“1a47c203.f9dc9e”,“type”:“serial-port”,“z”:“1d18ac42.887634”,“serialport”:"/dev/ttyO2",“serialbaud”:“300”,“databits”:“8”,“parity”:“none”,“stopbits”:“1”,“newline”:"\n",“bin”:“false”,“out”:“char”,“addchar”:false},{“id”:“879d3b35.230e98”,“type”:“debug”,“z”:“1d18ac42.887634”,“name”:“Sensor Output View”,“active”:true,“console”:“false”,“complete”:“true”,“x”:385.78334045410156,“y”:60.44999694824219,“wires”:[]},{“id”:“5eef16d7.037da8”,“type”:“serial in”,“z”:“1d18ac42.887634”,“name”:“Sensor Data”,“serial”:“1a47c203.f9dc9e”,“x”:124.7833251953125,“y”:150.683349609375,“wires”:[[“879d3b35.230e98”]]},{“id”:“52614fb3.59fe2”,“type”:“bbb-discrete-out”,“z”:“1d18ac42.887634”,“pin”:“P8_7”,“inverting”:false,“toggle”:true,“defaultState”:“1”,“name”:“Interrupt to Sensors”,“x”:284.38330078125,“y”:348.3000183105469,“wires”:[[“ff5b799a.86d1a”]]},{“id”:“bdbd2367.9d45a”,“type”:“inject”,“z”:“1d18ac42.887634”,“name”:“Poll Sensors”,“topic”:"",“payload”:"\n int",“payloadType”:“str”,“repeat”:"",“crontab”:"",“once”:false,“x”:126.38330078125,“y”:283.7333679199219,“wires”:[[“52614fb3.59fe2”]]},{“id”:“ff5b799a.86d1a”,“type”:“trigger”,“z”:“1d18ac42.887634”,“op1”:“int”,“op2”:“0”,“op1type”:“val”,“op2type”:“pay”,“duration”:“250”,“extend”:false,“units”:“ms”,“reset”:"",“name”:“Reset”,“x”:468.08331298828125,“y”:352.0333251953125,“wires”:[[“b8a60fb7.8d86f”]]},{“id”:“b8a60fb7.8d86f”,“type”:“bbb-discrete-out”,“z”:“1d18ac42.887634”,“pin”:“P8_7”,“inverting”:false,“toggle”:true,“defaultState”:“1”,“name”:“Reset to HIGH”,“x”:611.38330078125,“y”:405.96668243408203,“wires”:[[]]},{“id”:“7e38a1db.de0088”,“type”:“comment”,“z”:“1d18ac42.887634”,“name”:“Send Interrupt to Arduino”,“info”:"",“x”:385.7833251953125,“y”:286.9666748046875,“wires”:[]},{“id”:“b75bbc4d.e19d18”,“type”:“comment”,“z”:“1d18ac42.887634”,“name”:“Serial Port Setup”,“info”:"",“x”:142.0833282470703,“y”:79.08333587646484,“wires”:[]}]

Hi James,

Take your serial port on the BBB and tie TX to RX. Use Screen or some
other program to test your ports.

Still no luck.

That did not help unfortunately, thanks anyway.

Hi James,

Which Port Pins of Beaglebone Red you have connected to which pins of
Arduino, and the output of that port pin properties in /sys we might
be able to help.

Thanks
Manav

There are too many variables here to know what exactly is going on. Id actually use Node to test your connection as such . . .

(function() {
var fs = require(‘fs’);
var rs = fs.createReadStream(’/dev/ttyO0’);

rs.on(‘data’, function(chunk){
process.stdout.write(chunk.toString());
});
})();

Just change the device path . . . and this code does work. For writes, use createWriteStream() instead, and it’s nearly as simple.

Some things that may be obvious to check.

Make sure that you swap data line from one device to the next. e.g. tx<->rx, rx<->tx.
Make sure you load the proper device tree files, and disable the universal IO device tree file. IF you do not want to use it.

Disconnect all your serial ports, and just work on a single port until you get something working.

I am using Beaglebone Black. I have connected pin 1 (tx) of the arduino to the rx input of my voltage level shifter, and then the result into pin 26 (UART1_RX) of the BBB. I have wired pin 0 of the artuino (rx) in a similar manner to pin 24 of the BBB.

So just two pin's... Where's your ground pin connected?

Regards,

GND (pin 1 on P9 rail) is connected to the arduino’s GND & my protoboard’s GND rails

I believe I have found the problem. I need to get both the UART and the digital I/o pins enabled at the same time in the device tree, however when I edit uEnv.txt to enable the UART in the usual manner, universal i/o is no longer enabled, I am trying to explicitly enable that as well as the UART1. I’ll keep you all posted. Advice on this is also highly appreciated.

universal i/o will disable it self, if you force something else via
cape_enable in /boot/uEnv.txt

Regards,

Thank you for the pointer. I’ll look for the name of the i/o pin I’m using and enable that manually.

-James

IT seems that whenever I enable the UARTs I cannot enable the appropriate digital i/o pins

ie I do this in uEnv.txt

cape_enable=bone_capemgr.enable_partno=PyBBIO-gpio2_2,BB-UART1,BB-UART2,BB-UART4

I find it easier to just write an overlay and load after boot time
much easier to test and debug.

Wrote my own device tree overlay. About to test to see if it works. Thanks for all the help and advice!