Robus - Part 3: The protocol definition
Robus simply adds some information to guarantee the good transmission and reception of the messages through physical support.
Here is a complete representation of a Robus message:
Robus CRC calculation
To secure, transfer, and detect communication errors, Robus provides a CRC calculation to verify the data transfer integrity.
CRC computation specificities
Robus CRC is a CRC16 with a polynomial 7 → 0x0007 = X^2 + X^1 + X^0
- Width = 16 bits
- Truncated polynomial = 0x0007
- Initial value = 0xFFFF
- Input data is NOT reflected
- Output CRC is NOT reflected
- No XOR is performed on the output CRC
Transmission
Before sending a message through the network, Robus computes and adds two CRC bytes at the end of the message. The CRC is computed on the complete header and data bytes. This CRC calculation is made by software for the transmission.
Reception
During the reception, a CRC computation is performed for each byte received. At the message's end, Robus compares the CRC calculated by the sender with the one initially calculated.
In case of a wrong CRC, the message is dropped, and a NAK is sent in case an acknowledgment is needed.
This CRC calculation can be software or hardware when the MCU you use provides a built-in CRC computation module.
Robus frame separator (timeout/preamble)
Robus network is a multi-master half-duplex network with a variable payload frame. All communication buses must have a delimiter to separate the frames from one another. Robus protocol uses an inactive period to achieve that. This period is called "timeout", but you can also see it as a message preamble.
Frames on Robus are serialized and sent in a 10-bit pack (one start-bit, 8 bits of data, and one stop-bit). The time needed to transmit those bits depends on the serial communication baudrate.
E.g.: Serial communication baudrate = 1Mb/s → Time for 1 bit is 1 microsecond → Basic timing = 1 microsecond.
In this example, sending one byte of data takes 10 microseconds.
Robus timeout is the time needed to transmit three bytes (or twenty times the basic timing).
Timeout = 30 * Basic timing
In the previous example, Basic timing = 1 microsecond → Timeout = 30 microseconds.
Each time Robus receives or sends a byte, the timeout counter is reset. When no byte is received during the timeout period, Robus will consider that the current frame is finished and will try to send a new one if some messages are waiting to be sent.
Robus acknowledge frame
Luos protocol provides the possibility to send messages from service to service. You can ask Luos engine to guarantee a good understanding of your message by the receiver using an acknowledgment byte (status_t
struct).
In the Robus protocol, the acknowledgement byte is a byte sent back by the receiving node before the end of the timeout.
The acknowledgment byte value can be:
- "ACK" if the message has been received.
- "NACK" if there is a bad CRC calculation or framing error detected.
If the transmitter node has received no ACK nor NACK, the message transmission will be considered failed, and Robus will retry it ten times.
If, after tenth times, the message transmission still fails, the message will be dropped, and an alert on Luos_statistics
will be raised.