Skip to content

Connect serial and CAN devices

eaxScadaHow-to guideStarterProEnterpriseView as Markdown

Migrated page, not yet verified against the current code. Treat values, paths and examples as indicative until this notice is removed.

eaxScada polls field devices on serial lines and CAN buses as driver channels, like any other protocol: a channel is one line or bus, each device on it is one unit or node, and tags map device addresses to UNS paths. Values carry quality (GOOD, UNCERTAIN, BAD) and every write goes through the same write policy as the rest of the system (confirmation, e-signature, read-only tags, standby node).

Protocol Channel protocol Medium
Modbus RTU MODBUS_RTU RS-485 / RS-232 serial port, or a serial device server (tcp://host:port)
Modbus ASCII MODBUS_ASCII as RTU
Modbus RTU over TCP MODBUS_RTU_TCP serial device server or gateway in transparent mode (RTU frames with CRC on a TCP socket)
CANopen CANOPEN SocketCAN interface (Linux), or an SLCAN adapter on a serial port or device server
Raw CAN CAN_RAW as CANopen
Network topologySerial lines and CAN buses as channels
Serial lines and CAN buses as channelsEach channel is one line or bus. eaxScada reaches an RS-485 line through a serial port or a serial device server (Modbus RTU or ASCII), or through a gateway in transparent mode (Modbus RTU over TCP); each unit on the line is a station with its unit id, 1 to 247. It reaches a CAN bus through a SocketCAN interface or an SLCAN adapter (CANopen or raw CAN); each node is a station with its node id, 1 to 127.eaxScadaa channel perline or busSerial portCOM5, /dev/ttyUSB0,or a device servertcp://host:portTransparent gatewayits address andTCP portCAN interfaceSocketCAN can0, orslcan:COM7,slcan:tcp://host:portRS-485 lineStationsunit id1-247CAN busStationsnode id1-127MODBUS_RTU,MODBUS_ASCIIRTU_TCPCANOPEN,CAN_RAW
One channel per line or bus, one station per unit or node: the station id is the address on that line.
  • Product
  • Service or process
  • Device or controller
  • Bus or line
Read as text

Each channel is one line or bus. eaxScada reaches an RS-485 line through a serial port or a serial device server (Modbus RTU or ASCII), or through a gateway in transparent mode (Modbus RTU over TCP); each unit on the line is a station with its unit id, 1 to 247. It reaches a CAN bus through a SocketCAN interface or an SLCAN adapter (CANopen or raw CAN); each node is a station with its node id, 1 to 127.

Parts

  • eaxScada (product): a channel per line or bus
  • Serial port (service or process): COM5, /dev/ttyUSB0, or a device server tcp://host:port
  • Transparent gateway (service or process): its address and TCP port
  • CAN interface (service or process): SocketCAN can0, or slcan:COM7, slcan:tcp://host:port
  • RS-485 line (bus or line)
  • Stations (device or controller): unit id 1-247
  • CAN bus (bus or line)
  • Stations (device or controller): node id 1-127

Connections

  • eaxScada → Serial port (relation): MODBUS_RTU, MODBUS_ASCII
  • eaxScada → Transparent gateway (relation): RTU_TCP. Channel protocol MODBUS_RTU_TCP: RTU frames with their CRC on a TCP socket.
  • eaxScada → CAN interface (relation): CANOPEN, CAN_RAW
  • Serial port → RS-485 line (relation)
  • Transparent gateway → RS-485 line (relation)
  • RS-485 line → Stations (relation)
  • CAN interface → CAN bus (relation)
  • CAN bus → Stations (relation)

The settings of each channel are listed in Driver channels, devices and tags. For a Rockwell / Allen-Bradley MicroLogix, SLC 500 or PLC-5 on its serial port (DF1 full-duplex), see Connect a MicroLogix, SLC 500 or PLC-5 on a serial port (DF1).

In the Studio, Drivers → Add connection, and choose Modbus RTU serial line (or Modbus ASCII serial line): this creates the line. Then set:

  • Serial Port: COM5 on Windows, /dev/ttyUSB0 on Linux. A serial device server in raw TCP mode is entered as tcp://192.168.1.200:4001.
  • Baud Rate and Data / Parity / Stop: as configured on every device of the line. RTU is normally 8-E-1 (8-N-2 when the devices use no parity); ASCII is normally 7-E-1. One port runs at one setting: a second channel on the same port with different settings is refused.
  • Byte & Word Order: how the devices lay out 32- and 64-bit values over registers (ABCD big-endian, CDAB word-swapped, BADC byte-swapped, DCBA little-endian). Single 16-bit registers are always big-endian.
  • Request Timeout and Retries (channel timing section): the time a request waits for an answer, and how many times a read is repeated after a timeout or a checksum error.

A line is a whole RS-485 segment. Drivers → Add station, choose the line, and enter the device’s unit id (1-247); repeat for each unit on the line. A unit id already on the line is refused. The line’s Default Unit ID is used only by a station without a unit id (one from an older configuration). See Connections, lines and stations.

Addresses are the same as for Modbus TCP: HR:<offset>, IR:<offset>, COIL:<offset>, DI:<offset> (protocol offsets 0-65535), or a classic reference such as 40001. The tag’s data type sets how many registers are read: Int16, UInt16 and Bool take one register; Int32, UInt32 and Float32 two; Int64, UInt64 and Float64 four.

A tag’s Access is a property of the field point, enforced by the server for every protocol: Read Only (RO) refuses every write before anything is sent to the device, whoever asks (an administrator, a NATS command, an approved AI setpoint, a script or faceplate through the HMI). The write is answered 409 Conflict with the reason (tag <path> is read-only) and the refusal is recorded in the audit trail. Read / Write (RW, also a mapping saved without an access) and Write Only (WO) are written. Tags that are not mapped to a device (internal tags) are not affected.

Modbus carries no names, so a device is browsed from an imported register map (CSV), exactly as for Modbus TCP. The browse reads every row back from the device and shows which addresses answer.

  • Frames are separated by the inter-frame silence: 3.5 character times, fixed at 1750 µs above 19200 baud. Inter-frame Silence overrides it.
  • Turnaround adds quiet time after every transaction, for slow devices and radio modems.
  • One transaction is on the line at a time. Several channels on the same port share it safely.
  • RS-485 direction by OS asks Linux to drive RTS for the transmitter (with RTS lead and RTS lag). Most USB adapters switch direction automatically and need nothing; on Windows the option is refused.
Condition Tag quality Notes
Valid answer GOOD
Timeout, CRC/LRC error, wrong unit or function BAD the reason is shown on the tag and the channel
Exception from the device (e.g. illegal data address) BAD not retried: the device answered
Unit silent for 3 consecutive timeouts BAD the unit is polled once every 5 s until it answers again, so a dead unit does not slow the others
Port missing, in use or unplugged BAD the port is reopened every 2 s

Writes are sent once. A write that gets no answer is reported as not confirmed: the device may or may not have applied it, and repeating it automatically could apply it twice. Writes to unit 0 (broadcast: every unit executes it, none answers) are refused unless Allow broadcast writes is set on the channel. A value that does not fit the register type (70000 into a UInt16, 1.5 into an integer) is refused rather than truncated. A write value travels as a 64-bit float, so an Int64 or UInt64 write is limited to ±9007199254740992 (2^53), the range in which every integer is exact; a larger value is refused rather than rounded.

Use MODBUS_RTU_TCP when a serial device server or gateway forwards the RTU frames unchanged over TCP (often called transparent or raw TCP mode). Enter its address and TCP port. If the gateway converts to Modbus TCP (MBAP header), choose Modbus TCP gateway (several devices behind one IP address) instead and add one station per unit id (see Connections, lines and stations).

Every Modbus channel reads in blocks when its device has block reads on (Enable Block Read Optimization on the device, block_read_optimization; on for a device created in the Studio): Modbus TCP, the Modbus TCP gateway, Modbus RTU, Modbus ASCII and Modbus RTU over TCP. Within a poll, tags of one unit id and one area (coils, discrete inputs, holding registers, input registers) whose addresses are close are read with one request. Each tag takes its own registers or bits from that answer, at its own address.

  • Size. A block holds at most 125 registers or 2,000 bits (the protocol’s limit), and at most the device’s Max Block Read Size (in registers; 16 bits per register for coils and discrete inputs). A device created in the Studio has 64.
  • Gaps. A block spans at most 16 unmapped registers, or 64 unmapped bits, between two tags. To change it, set Block gap (registers) (0 to 125, empty: 16) and Block gap (bits) (0 to 2000, empty: 64) on the connection form in the Studio (Modbus TCP, the gateway, RTU, ASCII and RTU over TCP), or block_gap_registers and block_gap_bits in the channel’s settings. 0: only tags next to each other are read together. A value outside its range, or not a whole number, is refused on save: “Not saved: Block gap (registers) is a whole number from 0 to 125, or empty for the default (16).”
  • A refused block. When the device answers a block with exception 01 (illegal function), 02 (illegal data address) or 03 (illegal data value), its tags are read again one by one in the same poll, so one bad address makes only its own tag BAD. The refused address is remembered: it is read alone from then on, and no block spans it.
  • Other failures. A timeout, a lost connection or another exception (04 device failure, 0B gateway target failed to respond) makes every tag of the block BAD with that error.
  • Fresh values only. A block’s answer serves only the poll that read it, and only within the request timeout. A later poll reads again. A write ends the poll’s blocks: the reads after it in that poll are made one by one.
  • Inter-request delay. The channel’s delay between requests (inter_request_delay_ms) applies only after a read that sent a request, not after a tag served from a block already read.

A tag alone in its block, and every tag of a device with block reads off are read with their own request, as before. Writes are never grouped.

  • Linux: configure the interface with the system, then name it in the channel: ip link set can0 type can bitrate 500000 && ip link set can0 up, interface can0.
  • Any system, including Windows: a USB CAN adapter that speaks the SLCAN protocol appears as a serial port. Enter slcan:COM7 (or slcan:/dev/ttyACM0) and the bit rate; eaxScada sets the rate and opens the adapter. An SLCAN adapter behind a serial device server is slcan:tcp://host:port.
  • A SocketCAN interface name on Windows is refused with a message pointing to SLCAN.

Drivers → Add station, choose the bus, and enter the device’s CANopen node id (1-127).

Address Reads Writes
SDO:0x6064:0 object 6064h sub 0 by SDO (expedited or segmented) SDO download of the value
TPDO1:2 bytes 2.. of the node’s transmit PDO 1 (COB-ID 180h + node) refused
TPDO1:0.3 bit 3 of byte 0 (Bool) refused
PDO:0x1A5:0 a PDO by its COB-ID refused
NMT NMT state: 0 boot-up, 4 stopped, 5 operational, 127 pre-operational NMT command: 1 start, 2 stop, 128 pre-operational, 129 reset node, 130 reset communication
EMCY last emergency error code (0 = none) refused

The tag’s data type sets the size and encoding (CANopen is little-endian): Bool, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64.

PDO values are read-only in eaxScada: process outputs carried by RPDOs belong to a controller with a deterministic cycle. Write parameters by SDO.

Browsing a node reads its identity and its transmit PDO mapping from the node itself (objects 1800h-1803h and 1A00h-1A03h), and lists each mapped object as a ready-made PDO tag. Import the node’s EDS file as the device’s register map to see object names and types, and to list its objects as SDO tags with their current values.

  • Heartbeat Timeout: a node whose heartbeat is older than this is lost, and every tag of the node is BAD until it is heard again. Set it to about three times the node’s heartbeat period. Node Guarding polls nodes that produce no heartbeat.
  • PDO / Frame Stale: a PDO value older than this is UNCERTAIN (last value kept). A PDO value is also UNCERTAIN while its node is not operational.
  • SDO Poll Interval: an SDO tag is read at most this often; SDO is a request/response service and polling it at the scan rate loads the bus.
  • SDO aborts are shown with their meaning (for example object does not exist in the object dictionary).
  • Nodes are not started automatically. Enable Start nodes (NMT) when first polled only when this channel is the network manager: an operational node acts on the RPDOs other devices send it.
  • The channel produces no SYNC unless SYNC Period is set; a bus must have only one SYNC producer.
  • NMT commands to node 0 (every node) are refused unless Allow NMT broadcast is set.
  • An SDO write to a node that is lost is refused.

CAN_RAW decodes values from any CAN frame without taking part in CANopen. Addresses are FRAME:<id>:<byte>[.<bit>], with the id in hex; ids above 7FFh are extended 29-bit ids. Browsing lists the ids heard on the bus and their bytes. Values are read-only.

Each serial and CAN channel shows Link diagnostics under its settings in the Studio, and the same figures appear in the driver diagnostics (link_stats): frames sent and received, CRC/LRC errors, timeouts, exceptions, retries, units that stopped answering, and for CAN the SDO requests and aborts, heartbeat losses, emergencies and the state of every node. A count of checksum errors or timeouts that keeps rising while tags stay GOOD is the early sign of a marginal line: termination, biasing, grounding or one device at the wrong baud rate.

  • Modbus: point a MODBUS_RTU_TCP channel, or a MODBUS_RTU channel with port tcp://host:port, at a Modbus RTU simulator listening on TCP.
  • CANopen: on Linux, a virtual CAN interface behaves like a real bus: ip link add dev vcan0 type vcan && ip link set vcan0 up, interface vcan0.
  • Any channel can be set to simulated mode ("simulated": true in its settings): no port or bus is opened, values are generated, and the channel, its devices and its tags are marked SIMULATED everywhere. The server marks each value simulated: SIM on screens and trends, simulated history samples and alarm events. An interlock that reads one stays active unless it is Allowed in commissioning, a limit tag on one refuses the write, and the plant e-stop signal on one reads as unknown (fail closed). Switching the channel to or from simulated restarts it; its next reading carries the new mark. See Accept or refuse simulated PLCs.