Access to Industrial Gateway Serial Port

Since there isn’t a Category for the Gateway lets see if this is the right place!

We have written a Python program that is run on the Digi Industrial Gateway. ( Either from the debug environment or loaded into the gateway and auto run ). The aim is to attach to the internal XBEE serial port, parse the incoming data a little and forward it to a socket connection and visa versa.

Once the gateway is up and running it establishes a mesh with several XBEE’s in the field.

We can then attach to the gateway with a terminal program such as TerraTerm and open a tcp/ip telnet ( socket ) session to our programmed port. The port opens and a simple text message is received. ie ‘Our Gateway Program v1.0’

very little now happens beyond this!

Our Mesh is sendin periodic status updates every few seconds and this data should be appearing on the socket.

But it doesn’t work… until

We open an SSH session into the gateway linux command line and execute the following from the command line

(stty raw; cat > dump.txt) < /dev/ttyS1

This Linux utility pipes the incoming serial to the file received.txt

we let it run for a minute or so ( or monitor the size of the txt file until see some data appears in it. )

Ctrl ‘C’ to stop the pipe redirect.

The telnet session now start to output data.

We have chased port settings and processes running on the gateway and cannot see why the pipe seems to ‘unlock’ the port. Initially we chased the stty raw setting as it sets some initial parameters on the tty port but it turns out that running stty -F /dev/ttyS1 raw alone makes no difference. ( Except to set ttyS1 into raw mode ) running cat > adump.txt < /dev/ttyS1 for a second or two then appears to ‘open’ the serial port.

BTW as expected once the Gateway is connected and communicating with the sockets running the redirect serial to file command appears to ‘consume’ all the serial IO, stopping it ( Ctl C ) allows the python program access to data again.

Short of executing some sort of script at start-up I’m now stumped!