Raspberry Pi Serial and Node-Red issues

SOLVED: Node-Red serial I/O

serial

Looks simple doesn’t it – tie RX and TX together on your Raspberry Pi and press the button – text comes out of the other end – except that it doesn’t. More likely the Pi will CRASH (not something you see every day).

Serial out seems fine – no error messages, you can change baud rate and according to my scope, all is fine on pin 8 of the RPi2.  Input on the other hand, can cause interrupt issues, messages on the console and crashing – and almost never actually produces any output.

So what is the problem?Well, one of the guys at the Node-Red forum set me onto this link.  http://jeelabs.org/2012/09/20/serial-hookup-jeenode-to-raspberry-pi/

And therein lies the problem – by default – the RPI uses the serial port for communications. Trying to add another hook to the serial in interrupt – kills the Pi.

The solution is simple – extracted from the above link.

  1. edit the file /etc/inittab as root (I used “sudo vi /etc/inittab”)
  2. change this line: T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 to#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100. I.e. comment it out, and save these changes.
  3. run the command “sudo kill -1 1” to pick up these inittab changes

And that  – was that  – I now have comms in and out  – the idea being to put a serial display such as the NEXTION onto the Pi with simple touch input commands – and an output display showing status, temperature etc. DODDLE in Node-Red once you have serial up and running.

3 thoughts on “Raspberry Pi Serial and Node-Red issues

  1. Skinning the recursive search cat in a different way for bigger directory structures is also fairly easy:-

    find /etc | xargs egrep -i ttyama0

    find /boot | xargs egrep -i ttyama0

  2. Yup, the console is special. You almost certainly have a login process running on it, as well as some
    debug messages being squirted there by the system (not running Raspian on anything, so the following might
    be a load of cobblers, but it should get you started in the right direction).

    You should have a file called something like /etc/ttytab or /etc/inittab (or maybe even /etc/ttys) which enables
    a login process on your port. Use “egrep -i ttyama0 /etc/*” to find the file and then disable the entry (it’ll be
    obvious from the other entries how to do this for Raspian). The kernel probably also has a special setting in the
    boot process to enable debug messages to the port. Use the same command (but point it at /boot …see below) to find that setting and then comment it out.

    [Tip:- You can keep on adding sub-directory searches by doing “!!/*” (bang, bang, slash, asterisk) on the line following your initial command …the “!!” means “repeat the last command” and the “/*” gets appended to it. So if your first command was “egrep -i ttyama0 /boot/*”, the second command (after
    the bang-bang) will become “egrep -i ttyama0 /boot/*/*”. Just keep repeating the process until it gives a “no such file or directory” error.]

Comments are closed.