S-BUS

Print version

S-BUS protocol for MORSE

Protocol description

version 7.21

8/25/2008

1. Introduction

The S-Bus protocol for MORSE (hereinafter S-Bus-MORSE) is implemented into the MORSE system as an access module for communication with the SAIA PCD device. The protocol is a MASTER/SLAVE type, the MASTER does not have its own address. There can be at most 254 SLAVEs, the address 255 is reserved for broadcast transmitting which is not acknowledged. The physical layer of the S-Bus protocol uses the RS232 or RS485 interface. The broadcast is implemented into the MORSE system, the data addressed to 255 is processed as broadcast.

Tab. 1: Basic protocol commands (S-Bus Code)

 ReadWrite
Input0x03x
Output0x050x0D
Flags0x020x0B
Register0x060x0E
Counter0x000x0A
Timer0x070x0F
Data Block0x960x97
RTC0x040x0C

a) Break mode (SM0)

The frames are synchronised by the break characters of a configured length which are sent before the addressed command.

b) Parity mode (SM1)

Obsolete, not supported in the MORSE system

The parity bit defines the frame type:

  • 1 – address

  • 0 – data

c) Data mode (SM2)

Frame synchronization is accomplished by inserting the character 0xB5 in the beginning of frame. If another character 0xB5 should appear in the frame, then it is replaced by the following DLE sequence:

characterDLE sequence
0xB50xC500
0xC50xC501

General format of the S-Bus frame in Data mode:

| FS/8 | AT/8 | Addr/8 | SC/8 | Data | CRC/16 |

  • FS – frame synchronization 0xB5

    • 0xB5

  • AT – attribute, determines the sort of frame:

    • 0x00: request frame, data writing, reading…

    • 0x01: response frame contains the data

    • 0x02: ACK/NAK

  • Addr – address in S-Bus network

  • SC – S-Bus Command, see table Basic protocol commands

  • Data – content according to respective S-Bus command

  • CRC – check sum

2. Data format

The link and/or network layer of the S-Bus-MORSE protocol distinguishes four types of frames.

All frames incoming from SCC are considered as Addressed. Only in this case, when the protocol expects a response to an Addressed frame, the first received frame having a proper BCW (ACK or NACK) is considered as Non-addressed.

After sending the Addressed command on SCC, the subsequently received frame is considered as the Non-addressed response. If the response to the sent frame is not received then the frame is repeated after time (t) with the number of repeats (r). When a response to an Addressed command is not received, then the S-Bus-MORSE protocol generates error message WIRE_LINK_FAIL. The Non-addressed frame is not repeated.

S-Bus frames sent to address 255 (0xFF) are processed by S-Bus-MORSE protocol as broadcasts and sent in this way to the MORSE network. The (B)roadcast parameters should be configured in the network for this case.

Four frame types are distinguished according to the content of the AT character:

A – DATA MODE

  1. Addressed command frame

    The Addressed command frame is transferred only when the BCW field fits. The Addr field is used for obtaining the destination network address. Both Addr and BCW fields are removed in the transmitting radio modem (Communication Unit – CU) or regenerated in the receiving CU. The packet type is USER DATA (0x09). Data format and example:

    | FS/8 | AT/8 | Addr/8 | SC/8 |  Data  | BCW/16 |
       B5     00      01      06     030000   5F4B
  2. Non-addressed response frame with data

    The Non-addressed response frame is transferred only when the BCW field fits. The BCW fields is removed or regenerated. The address of the opposite CU is established as the source address of the previous packet. The packet type is USER DATA.

    | FS/8 | AT/8 |             Data                      | BCW/16 |
       B5     01   0000 0A9D 0000 0A9D 83F3 0BED 1E06 3DCE   78F0
  3. Confirmation frames – ACK

    The ACK frame from SCC is accepted only in this case when the S-Bus-MORSE protocol is expecting a Non-addressed response. The address of the opposite CU is established as the source address of the previous packet. The packet type is USER DATA.

    | FS/8 | AT/8 |  ACK  | BCW/16 |
       B5     02     0000    23F4
  4. Negative confirmation frames – NAK

    The ACK frame from SCC is accepted only in this case when the S-Bus-MORSE protocol is expecting a Non-addressed response. The address of the opposite CU is established as the source address of the previous packet. The packet type is USER DATA.

    | FS/8 | AT/8 |  NAK  | BCW/16 |
       B5     02     0001    33D5

    ACK = 0x0000, NAK = 0x0001

B – BREAK MODE

Break mode does not use the items FS, AT. Instead of this the beginning of the frame is marked by the break characters of a configurable length.

  1. Addressed command frame

    | Addr/8 | SC/8 | Data/8 *N | BCW/16 |
       0x02    0x06   0x00000A    0xC250
  2. Non-addressed response frame with data

    | Data/8 *N | BCW/16 |
     0x0000 020E  0x87AC
  3. Confirmation frames – ACK

    | ACK code /8 |
         0x06
  4. Negative confirmation frames – NAK

    | ACK code /8 |
        0x15

Other frames are ignored.

  • Addr is the opposite station address

  • BCW is a Block Control Word, 16-bit CRC

  • ACK = 0x06

  • NAK = 0x15

These four frame types

are transferred by S-Bus-MORSE protocol as the MORSE net layer data, type user data, format:

  1. Addressed command frame

    | 0x01/8 | data |
  2. Non-addressed response frame with data

    | 0x04/8 | data |
  3. Confirmation frames – ACK

    zero-length frame
  4. Negative confirmation frames – NAK

    | 0x15/8 |

3. Example of Communication

A – DATA MODE

Example 1

Writing of digital value (SC=0D) to Slave 02, frame acknowledged ACK.

Monitoring of request and reply on the SCC link
PCD Master-CU and CU-PCD Slave
and on the internal interface CNI (MORSE packet):

Request, Master>CU

15:32:24.888 rx;i   11 | S01
B500 020D 0300 1003 0F1B D1
CNI mon     |toa      frm     |dst      src     |           size|TT N
15:32:24.889|                 |00000002 00000001|S01I   OUT   7||89 6usr 0
010D 0300 1003 0F

B5   - FS/8     - Frame start
00   - AT/8     - Addressed command attribute
02   - Addr/8   - Slave address in the S-Bus net
0D 0300 1003 0F - S-Bus data
1BD1 - CRC/16   - CRC

the destination MORSE address 00000002 is created from the item Addr/8

01              - Addressed command S-Bus MORSE
0D 0300 1003 0F - Data S-Bus

Request, CU>Slave

15:32:24.959|                 |00000002 00000001|S01I    IN   7|*89 0usr 0
010D 0300 1003 0F
15:32:24.959 tx     11 | S01
B500 020D 0300 1003 0F1B D1

B500 020D 0300 1003 0F1B D1 - frame delivered to PCD Slave is equal 
                              to frame sent from PCD Master

Reply, Slave>CU

15:32:24.974 rx;i    6 | S01
B502 0000 23F4
15:32:24.974|                 |00000001 00000002|S01I   OUT   0||89 0usr 0

B5   - FS/8   - Frame start
02   - AT/8   - ACK/NAK attribute
0000 - ACK
23F4 - CRC/16 - CRC

The ACK confirmation is transferred through the MORSE network 
as a zero-length packet.

Reply, CU>Master

15:32:25.035|                 |00000001 00000002|S01I    IN   0|*89 0usr 0
15:32:25.035 tx      6 | S01
B502 0000 23F4

B502 0000 23F4 - frame for PCD Master is equal to one sent from PCD Slave

This communication can be recapitulated in monitoring on SCC Master-RS:

15:32:24.888 rx;i   11 | S01
B500 020D 0300 1003 0F1B D1
15:32:25.035 tx      6 | S01
B502 0000 23F4

Example 2

Reading of analog register (SC=06) from Slave 02:

Request, Master>CU

15:32:37.516 rx;i    9 | S01
B500 0206 0100 64F3 DB
15:32:37.516|                 |00000002 00000001|S01I  OUT   5||89 7usr  0
0106 0100 64

B5   - FS/8   - Frame start
00   - AT/8   - Addressed command attribute
02   - Addr/8 - Slave address in the S-Bus net
06 0100 64    - S-Bus data
F3DB - CRC/16 - CRC

01            - Addressed command S-Bus MORSE
06 0100 64    - S-Bus data

Reply, CU>Master

15:32:37.645|                 |00000001 00000002|S01I   IN   9|*89 7usr  0
0400 0001 6300 0000 BB
15:32:37.645 tx     12 | S01
B501 0000 0163 0000 00BB C4E2

04                  - Non-addressed reply S-Bus MORSE
0000 0163 0000 00BB - S-Bus data

B5   - FS/8         - Frame start
01   - AT-8         - Reply with data
0000 0163 0000 00BB - S-Bus data
C4E2 - CRC/16       - CRC

This communication can be recapitulated in monitoring on SCC Master-CU:

15:32:37.516 rx;i    9 | S01
B500 0206 0100 64F3 DB
15:32:37.645 tx     12 | S01
B501 0000 0163 0000 00BB C4E2

B – BREAK MODE

Request to set up output (SC=0D), frame is acknowledged by the opposite station ACK:

15:01:01.933 tx      9 | S01
020D 0300 0A00 0117 92
15:01:02.055 rx;i    1 | S01
06

02       - Address
0D       - Request to set up output
03       - Number of data bytes in frame(4) 
000A0001 - Data
1792     - CRC

Request to read register No.10 with no-addressed response:

14:56:33.967 tx      7 | S01
0206 0000 0AC2 50
14:56:34.092 rx;i    6 | S01
0006 020E 87AC

Request:

02    - Address
06    - Request to read register
00    - Number of data bytes in frame(1) 
000A  - Data
C2 50 - CRC

Response:

00   - No-addressed response
06   - Request to read register
020E - Data
87AC - CRC

4. Configuration Parameters

S-BUS parameters:
(m):MASTER/SLAVE  (N):OFF
(t):300ms  (T):11500ms
(r):0  (b):5  (a):0000
(d)ata mode:OFF
(q)uit
(m)

(m):MASTER / SLAVE — Parameter “mode” is used to set up the standard mode MASTER/SLAVE or mode SLAVE+ (see Chapter 5)

(N)

(N): ON/OFF — ON = mode for numbering packets on transmission. It checks the packet number in the response (check packet Numbers) if they are not the same the packet is discarded. This only makes sense on the radio modem side by the PCD Master

(t)

(t): 300 ms — Parameter “timeout” serves for setting the time for waiting for a response when repeating to the SC channel. It has to have the time value required for transmitting the longest packet in the application.

(T)

(T):11500ms — Mechanism for reduction of the supply of packets from the SC channel (offered load, transmission control timeout) in the case of an unsuitably set-up application layer timeout in the centre.

Recommended time: T = Rsaia * TOsaia – 500 [ms]

Rsaia, TOsaia – Number of repeats and timeout of the connected Saia PCD device

After set time (T) the CU discards all (repeated) commands, which it gets on the SC channel from the centre (FEP). The reason is so as not to block the radio channel with repeated queries over the time until a reponse arrives over the radio network from the RTU.

(r)

(r): 3 — Parameter “repeats” serves for setting the number of repeats to the SC channel upon not receiving a response

(b)

(b): 5 characters — Parameter “break characters” serves for setting up the length of the break symbol. Only used in break mode

(a)

(a):0000 — Alarm message – under development

(d)

(d)ata mode: OFF — Mode selection

OFF – Break mode

ON – Data mode

Recommended timing PCD SAIA – according to manufacturer:

5. Spontaneous Activity of Slave Stations

Subordinate stations SAIA PCD in mode MASTER/SLAVE can transfer information to the S-Bus protocol to other subordinate stations (at a given moment they change to master mode). In this case it is possible that a collision may occur. The centre sends a query to the station which is currently in master mode, or one of the subordinate stations replies to two masters at once. Thanks to long timeouts these collisions, which need to be set up for radio transmission, are resolved for a long time.

If another protocol is used in the centre, e.g. MARS-A it is possible to switch protocols S-Bus-MORSE on all other radio stations to mode SLAVE+. Then all direct write requests (received from the SC channel) will be sent, the protocol will generate an ACK, and all direct read requests (received from the SC channel) will be discarded and the protocol will generate an NAK. Code distribution for mode SLAVE+ is in tab 1. Sent packets will have the first byte set to value 0x02 and will be USER DATA type packets. If the subordinate station wants to read data from the centre (FEP) it must use a write request for this communication and a higher communication layer must provide for transmission of the response in the opposite direction. Communication with activity “from the bottom” can also be designed in another way. RACOM provides communication software support for MORSE devices free of charge.

6. History

This description applies from version 7.21 from 10.9.2005