The SAIA driver is usually a master: the gateway polls a Saia PCD controller. This article covers the other cases: the gateway polling a PCD over a serial S-Bus line, and the gateway acting as an S-Bus station (slave) that a PCD master reads and writes, over UDP or a serial line. A typical use is to publish values of another protocol (BACnet, KNX, M-Bus…) to an existing Saia installation without changing its communication scheme.
Checked against: firmware r9347. Licence: the SAIA driver is a licensed feature (contact support@weble.ch). Level: integrator familiar with Saia PG5.
The Type field of the SAIA gateway selects the role and the transport:
| Type | Role of the gateway | Transport | Typical use |
|---|---|---|---|
udpMaster (default) |
Master: polls one PCD | Ether-S-Bus (UDP, port 5050) | Read and write the data of a PCD reachable over IP. |
serialMaster |
Master: polls one PCD | Serial S-Bus line | Same, for a PCD that only has a serial S-Bus port. |
udpSlave |
Station: answers a master | Ether-S-Bus (UDP) | A PCD program reads and writes the gateway like another PCD station. |
serialSlave |
Station: answers a master | Serial S-Bus line | Same, on a serial S-Bus line driven by a PCD master. |
The form adapts to the type: Host is only shown for udpMaster, Port for the UDP types, Serial Port and BaudRate for the serial types, and Request Timeout (ms) for the master types. For the slave types, Station is labelled Station (this box).
One gateway has one role and one station number. To poll several PCDs, create one master gateway per PCD; to answer as several stations, create one slave gateway per station.
For serialMaster and serialSlave:
| Field | Value |
|---|---|
| Serial Port | The serial interface of the gateway (RS-485 port or USB adapter). See Serial ports and USB adapters. |
| BaudRate | 1200 to 115200, default 9600. Use the same value as the S-Bus port of the PCD. |
| Station | Master: station number of the PCD to poll. Slave: station number the gateway answers to. Default 1. |
The driver uses the S-Bus Data mode with 8 data bits, no parity and 1 stop bit: configure the S-Bus port of the PCD in Data mode with the same baud rate. Connect the RS-485 pair to the S-Bus port of the PCD, respecting the polarity, and terminate both ends of the line.
On a serial line, a station number must be unique. When the gateway is a station, give it a number that no PCD of the line uses.
Goal: a PCD program reads the outdoor temperature from register 100 of station 10, which is the gateway. The temperature comes from a BACnet device already integrated on the gateway.
udpSlave (or serialSlave with Serial Port and BaudRate).5050 and Station (this box) to 10. Keep Address Offset at 0.In the PCD program, configure the S-Bus master channel to read station 10 at the IP address of the gateway, UDP port 5050 (or on the serial line).
Create the address before creating the route, with the datatype expected by the PCD program:
100 (address %saia_reg:100).floatBE if the PCD program reads the register as an IEEE 754 float;int32BE if it reads an integer (see 3.3 for tenths of a degree).0: a station does not poll, its values come from the routes and from the master.If the route writes to a register that does not exist yet, the address is created automatically with the datatype
int16BE, which keeps only 16 bits: the PCD would read a wrong value. Always create the station addresses first.
Create a route from the BACnet temperature to %saia_reg:100 (destination gateway: the SAIA slave gateway). Keep the default triggers, including gateway: the values held by the station are kept in memory only, and this trigger writes them again when the SAIA gateway restarts.
If the PCD program expects an integer in tenths of a degree, keep int32BE and convert in the Source value of the route:
function toTenths(v, src, dst, options){
return Math.round(v * 10) // 21.5 °C -> 215
}
Rounding in the function is more reliable than a Scale of 0.1 on the register, because the driver writes only whole numbers to integer datatypes.
When the PCD master writes registers, flags or outputs of the station:
%saia_reg:<n> as int32BE (one per written register), %saia_flag:<n> and %saia_output:<n> as bit. Change the datatype afterwards if the register holds a float.The master can also read registers, flags, inputs and outputs. A register or flag without address reads 0. Inputs cannot be written by the gateway (they are read-only in the driver): publish binary states as flags or outputs.
| Master command | Effect on the station |
|---|---|
| Read Registers (6), Read Flags (2), Read Inputs (3), Read Outputs (5) | Answers with the values held in memory. |
| Write Registers (14) | Stores the values, updates or creates %saia_reg: addresses. |
| Write Flags (11), Write Outputs (13) | Stores the values, updates or creates %saia_flag: / %saia_output: addresses. |
Address Offset applies in both directions: with an offset of -1, the address %saia_reg:100 is register 99 on the bus.
Open the address table of the SAIA gateway and click Monitor. Each telegram is listed with its direction (← RX received, → TX sent), station, command, first address, quantity, decoded data and raw frame. The monitor stops by itself after 5 minutes.
| What you see | Meaning |
|---|---|
| RX telegrams from the master, each followed by a TX answer | The station works. Check the address and the data of the answers. |
| RX telegrams without TX answer | The telegrams are addressed to another station number: check Station (this box) against the PCD program. |
RX with the error bad frame or bad crc |
The frames are corrupted: on a serial line, check the baud rate, Data mode, wiring and termination. |
| Nothing at all | The master does not reach the gateway: IP address and UDP port (firewall, VLAN), or serial port and wiring. |
As a master (udpMaster, serialMaster), the Monitor shows the requests of the gateway (TX) and the answers of the PCD (RX). An address status !timeout means the PCD did not answer within Request Timeout (ms); after 60 s with nothing but timeouts, the driver restarts.
0 until the routes write them again (keep the gateway trigger on these routes).| Symptom | Cause and fix |
|---|---|
| The PCD reads a wrong or truncated value | The register was created automatically as int16BE, or the datatype does not match the PCD program. Set int32BE or floatBE on the address. |
The PCD reads 0 after a restart of the gateway |
The route that feeds the register has the gateway trigger unticked, or its source has no value yet. |
| Writes of the master do not reach the other protocol | Check that the address was created (tab Registers / Flags / Outputs) and that a route starts from it. |
The gateway log shows missing license |
The gateway has no SAIA licence. |