RS232 / MDT Mode

Serial port accessory connection and communication

Mobile Data Terminal mode allows the Syrus to encapsulate data sent via the serial port based on different criterias. This allows you to connect any accessory/sensor that transmits data via RS-232/serial port and generate an event when an incoming message occurs.

General Overview

  • Instruct Syrus to use its RS232 RX & TX cables to work in mdt mode
  • Depending on the data that's received and its frequency you configure the mdt settings
  • Connect the external sensor/accessory to the Syrus RS232 RX & TX cables to start receiving data
  • View the data via Redis or generate events using Syruslang @mdt.message signal

Pinout

Syrus 4 Datasheet with Pinout

Serial Wiring Pinout (found in 14-pin molex)

Syrus Wires Syrus Signal Description
Orange RS232_TX Syrus rs-232 data transmitter cable, connect to the external accesory's data receiver cable.
Blue RS232_RX Syrus rs-232 data receiver cable, connect to the external accesory's data transmitter cable.

Configuration

Once you have the accessory connected to the Syrus you can configure the serial port to mdt mode with the apx-serial tool.

$ sudo apx-serial mode mdt

To configure the settings we'll take a look at two scenarios:

Scenario 1: Using packet size

A temperature sensor is connected via the serial port. The sensor is programmed to send temperature data every 10s, and when it reaches above 0°C.
We can set up the MDT mode to capture the data under these conditions with the following settings:

  • baudrate = 115200
  • type = x
  • timeout = 1 (Although the data is sent every 10s, the timeout essentially refers to how long it takes the data to reach the device, which for most cases is less than 1 second, however if the temperature value reaches 0°C at the 10th second mark, then it can send multiple packets in that 1 second, this is where the max_size comes in handy)
  • max_size = 5 (Assuming the data is 5 bytes you can use this to packet the data every 5th byte that way you only get 1 temperature value at a time even if it's reported at the same second)
  • header = 0 (Ignored)
  • tail = 0 (Ignored)
  • mask = 0 (Ignored)
  • offset = 0 (Ignored)

MDT Settings

apx-serial mdt settings 115200 x 1 5 0 0 0 0

Scenario 2: Using Mask

A card reader is connected via the serial port. Every time a card is presented it sends a message with a header + body + tail of fixed length.
We can set up the MDT mode to detect a change in the body of the message transmitted and send an event when that part of the message changes.
This way if the card is left on the reader and it's reading the same value it will only send when it changes its value.

<header>    <body n_bytes>    <tail checksum (always changes)>
# Card 1
0102        EBC8              FA0D0A
# Card 2
0102        EBC9              FB0D0A

With the MDT settings we may configure it as follow:

  • baudrate = 115200
  • type = x
  • timeout = 0 (ignored as we are interested in packing based on values)
  • max_size = 0 (ignored as we are interested in packing based on values)
  • header = '0102'
  • tail = 0 (we can ignore as it always changes)
  • mask = 4 (mask of 4 bytes for detecting changes to the body of the message)
  • offset = 5 (start at the 5th byte, after the header)

MDT Settings

apx-serial mdt settings 115200 x 0 0 0102 0 4 5

Sending and Receiving Messages

To send a message to the external accessory connected to the Syrus you can use the send command

# Send numbers 0-5
$ sudo apx-serial mdt send '012345'

The response would be visible on a terminal application

If you're using Pegasus application you can send data to the Syrus 4 via the MDT plugin under accessories.

Send a TAIP message over Syrus Cloud to the Serial Port of the Syrus

# Send the text 'message'
apx-serial send --msg=">RTXmenssage<"

Redis Interaction

When a message is received it's notified via redis

serial/notification/mdt/pack "303132333435"

Syruslang Script

The data received can be sent to any destination using Syruslang

define event incoming_message group=mdt fieldset=default code=0 [email protected]

Depending on the protocol used by the destination the data can be generated as

{
    "$mdt": {
        "message": "303132333435"
    }
}

Serial Console

The serial console mode allows you to send apx- commands to the Syrus via an RS-232 terminal using the device's RX/TX cables.
To configure the mode use the apx-serial command.

General Overview

  • The way it works is that you instruct the Syrus to use it's RS232 RX & TX cables to work in console mode
  • Connect the Syrus RX/TX cables to a mobile data terminal application
  • Send commands and receive responses from the terminal application

Installation

Syrus 4 Datasheet with Pinout

RS-232 RX/TX Pinout (found in 14-pin molex)

Syrus Wire Color Signal Description
Orange RS232_TX Syrus data transmitter. Connect to the RX line of the device you would like to communicate with.
Blue RS232_RX Syrus data receiver. Connect to the TX line of the device you would like to communicate with.

Configuration

After connecting the Syrus serial cables you can use the apx-serial tool to configure it.

Configure the RS-232 in Console Mode

$ sudo apx-serial mode console
Serial Port OptionsValue
Baudrate115200
Data bits8
ParityNone
Stop bits1

Once configured you can use a terminal application to send apx- commands to the device and receive a response.

Serial Port as a Destination Point

This mode lets you output JSON, TAIP or CSV events to the serial interface. Userful when the serial device is used to log or retransmit the events.

  1. Configure the destinations.syrus.conf file to send events.
    # In destinations.syrus.conf add the following destination
    define destination serial_destination taip serial://_._ ack=disabled
  1. Add the serial destination into the configuration.syrus.conf file to bind it to a group of events.
# Use this notation to send all tracking events to the serial port
set destinations group=tracking pegasus,serial_destination
  1. Now you should receive in the serial terminal the same events sent to Pegasus.