Looking at the RDS/UECP Frame information

Definition of the UECP frame

The UECP protocol for communication with a RDS encoder uses a variable length frame format.

The UECP Frame Format

Here is the frame:

RDS Frame

STA(Start): Each frame starts with special byte (FE hex). Byte stuffing is used to prevent this byte appearing in the data stream, other than as a start indicator.

ADD(Address): A 16bit word that is comprised of two parts, namely Site address (10bits most significant) and Encoder address (6bits least significant). The site address represents a group of encoders and the encoder address the specific encoder within the group.

SQC(Sequence counter): This a field that can be optionally used to detect a loss of frames, request a repeat. If not used it is 0x00.

MFL(Message field length): This is the field length of the message, excluding any byte stuffing. On reception the byte stuffing is removed and should remain with this length of message.

CRC(Cyclic redundancy check): This is a 16bit CRC using the CCITT-16 polynomial(x16 + x12 + x5 + 1). Initialised with 0xFFFF the calculation runs from the first address byte to the last message byte. The resultant word is stored in reverse byte order.

STP(Stop): Each frame is terminated with the special byte 0xFF to indicate the end of the current frame. Byte stuffing is used to avoid this byte appearing in other parts of the frame.

Byte stuffing is to used to avoind inter frame occurrance of the STA (0xFE) and STP (0xFF) bytes. The byte stuffed indicator is 0xFD. So these are three special byte codes that are converted into byte pairs.

Byte Byte Pair Purpose
0xFF 0xFD02 Stop byte
0xFE 0xFE01 Start byte
0xFD 0xFD00 Stuffing replacement

The table shows the stuffing replacements. On reception these byte pairs are replaced by the original single byte