[back to menu]

Protocole used to exchange data between server and clients

The communication between server and clients uses RS232 frames.

These frames are sent either by the server or a client.

The RS232 frame

STX ADD SLN CMD PAY1 .. PAYn CHK

Any other bytes are ignored until a new STX

- STX

This field is one byte long with the STX character (0x02)

- ADD

This field is one byte long and is divided in two nibbles:

- SLN

This field is one byte long and is divided in two nibbles:

The sequence number is incremented after sending a new frame. The sequence number counts from 1 to 15.
The sequence number 0 is only used once after start (for the first frame) and indicates a reset of the sender.

The sequence number is specific to the server and each client

The length of the payload may be 0 (no payload) to 15 bytes.

- CMD

This field is one byte long. It gives the kind of command send to the destination address.

- PAY

This field is from 0 to 15 bytes long. It holds the data corresponding to the command.
The data bytes are binary: each byte may hold any value from 0x00 to 0xff

The length of this field must match the length given in the SLN field.

- CHK

This field is one byte long. It holds a checksum value of the frame.

The checksum is computed as follows:
Summing all bytes of the frame (excluding STX) will give a value of 0

ADD + SLN + CMD + PAY1 + ... + PAYn + CHK = 0

Connection of the clients to the server

All clients are chained in the same RS232 line (daisy chain):

 ----------------------------------------------
|                  Addr=0                      |
| RS232TX          Server              RS232RX |
 ----------------------------------------------
     v                                   ^
     |    ----->-----     ----->-----    |
     |   |           |   |           |   |
  -----------     -----------     -----------
 |  RX   TX  |   |  RX   TX  |   |  RX   TX  |
 |   Addr=1  |   |   Addr=2  |   |   Addr=3  |
  -----------     -----------     -----------

When a client receives a frame in its RX line, it has to analyse the ADD field:

Mandatory commands

All clients must answer to a ping request and to an ident request. These frames are used to know and identify the list of available clients in the daisy chain.

- Ping

The ping is CMD=1

Exemple of a ping frame sent by server (address=0, sequence=4) to 433MHz receiver (address=1):
02 01 41 01 C6 F7

Answer to the ping frame (sequence=15):
02 10 F1 01 C6 38

The payload includes 1 byte. The value of this byte is chosen by the sender and must be copied in the answer without any change

The checksum of the answer frame must be re-computed.

Note: The server sends a ping frame to itself to check the continuity of the RS232 loop. This ping frame will be relayed by each client up to the server.

- Ident

The ident is CMD=2

Exemple of an ident frame sent by server (address=0, sequence=5) to 433MHz receiver (address=1):
02 01 50 02 AD

Answer to the ident frame (sequence=1) with the string "RX V2":
02 10 15 02 52 58 20 56 32 87

There is no payload in the ident request.

[back to menu]