How to disconnect serial port for programming?

912 views
Skip to first unread message

Hermann

unread,
Apr 15, 2015, 3:26:15 PM4/15/15
to node...@googlegroups.com
Hi guys,

here is the situation:
I have a board based on the Moteino that plugs into the Raspi and talks to node-red over /dev/ttyAMA0.
OTOH I also write the Arduino program on the Raspi itself and upload it over the same /dev/ttyAMA0.
When I do that I get an error: connection in use. Makes sense... So I open node-red editor, disconnect the flow from the serial port, deploy, upload the sketch, reconnect to the serial port, deploy, test/change the sketch, disconnect... You get it!
Is there another way to disconnect the serial port from node-red? E.g. via command line or so...

Hermann


Dave C-J

unread,
Apr 15, 2015, 3:36:29 PM4/15/15
to node...@googlegroups.com
Not really (that I can think of). May be slightly quicker to actually stop Node-RED altogether Ctrl-c and then restart it - so not disconnect and deploy etc...

Luis Montes

unread,
Apr 15, 2015, 3:52:21 PM4/15/15
to node...@googlegroups.com
Might want to try my node-red-contrib-gpio node instead for arduino.  On the node close events I attempt a serialport .end() call.

On Wed, Apr 15, 2015 at 12:36 PM, Dave C-J <dce...@gmail.com> wrote:
Not really (that I can think of). May be slightly quicker to actually stop Node-RED altogether Ctrl-c and then restart it - so not disconnect and deploy etc...

--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hermann

unread,
Apr 15, 2015, 3:52:24 PM4/15/15
to node...@googlegroups.com
Thanks for the answer Dave. I was just thinking maybe there is an easier way to do that. Restarting node-red would take less clicking but much more time...
So I will have to make less mistakes in the Arduino porgramm.. ;-)

Dave C-J

unread,
Apr 15, 2015, 4:03:51 PM4/15/15
to node...@googlegroups.com
Luis, 
the main serialport node also closes the serialport on close... but the only time that happens is when we exit or redeploy - the port is held open while running - so he can't reuse it from outside to download to Arduino without stopping.

Luis Montes

unread,
Apr 15, 2015, 4:47:44 PM4/15/15
to node...@googlegroups.com
Got it, missed the part where he didn't want to redeploy.

And this won't help in this case of using a native serial programmer (direct break, dtr, signaling, etc.), but for mailing list posterity if anyone needs multiple processes to send data to and from a serial port an option could be to use node to bind the serial port and relay bytes via mqtt with https://github.com/monteslu/mqtt-serial or just bind to a simple tcp socket server such as https://gist.github.com/monteslu/b5ad4c46c9b6b78f7aea  both of which transports are supported by node-red-contrib-gpio :)


On Wed, Apr 15, 2015 at 1:03 PM, Dave C-J <dce...@gmail.com> wrote:
Luis, 
the main serialport node also closes the serialport on close... but the only time that happens is when we exit or redeploy - the port is held open while running - so he can't reuse it from outside to download to Arduino without stopping.

--
Reply all
Reply to author
Forward
0 new messages