I'm trying to use node-red-node-serialport 0.10.1 and Node-Red 1.0.4 to send "hello world" to /dev/ttyS1 every 5 seconds, but nothing is wiggling yet. I have a short "hello world" script written in Python using the Cloud9 IDE to verify that my connections and settings are OK.
I get the following message about "permission denied" every time I re-Deploy or restart the flow:
4/12/2020, 3:35:22 PMmsg : string[85]
"serial port /dev/ttyS1 error: Error: Error: Permission denied, cannot open /dev/ttyS1"
4/12/2020, 3:35:27 PM[node: 9990c610.f0304](http://192.168.7.2:1880/#)msg.payload : string[11]
"hello world"
4/12/2020, 3:35:32 PM[node: 9990c610.f0304](http://192.168.7.2:1880/#)msg.payload : string[11]
"hello world"
I understand from the docs that the Beaglebone is configured to run Node-RED as root. I checked the permissions on /dev/ttyS1 as follows:
brent@beaglebone:~$ ls -l /dev/ttyS1 crw-rw---- 1 root dialout 4, 65 Apr 12 20:27 /dev/ttyS1
So from that I'm concluding that 'root' does have read and write permissions on /dev/ttyS1. (I even added 'root' to the dialout group but that was probably redundant and of course it made no difference.)
Subsequent messages do not get the same "permission denied" message so I'm unsure if that warning is my biggest clue.
Don't know if this will be a clue, but it took me a while to get this serial port working at all (that is, from Cloud9 and Python). The key there was to un-comment the following line in my uEnv.txt:
uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo
Here's my actual flow:
[{"id":"21fba7ae.f79fb8","type":"tab","label":"helloworld_serial","disabled":false,"info":""},{"id":"42c574f1.0e9eac","type":"serial out","z":"21fba7ae.f79fb8","name":"BBB S1","serial":"e29166d6.965718","x":480,"y":100,"wires":[]},{"id":"d4f598ef.53de2","type":"inject","z":"21fba7ae.f79fb8","name":"","topic":"","payload":"hello world","payloadType":"str","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":100,"wires":[["42c574f1.0e9eac","9990c610.f0304"]]},{"id":"9990c610.f0304","type":"debug","z":"21fba7ae.f79fb8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":340,"y":180,"wires":[]},{"id":"e29166d6.965718","type":"serial-port","z":"","serialport":"/dev/ttyS1","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\n","bin":"false","out":"char","addchar":"\\r\\n","responsetimeout":"10000"}]