RTU Framing & CRC

Dissect the Modbus RTU frame: address + PDU + CRC-16, the 3.5-character silent interval, and verifying a frame with "whole-frame CRC = 0"

Chapter Objectives

Scenario: A Kraft-Paper Letter

The "verbs" from Chapters 4 and 5 (function code + address + data) are ready. Now they have to travel—first along the old railway of the serial line (RS-485), that is, Modbus RTU. An RTU frame is like a kraft-paper letter: the recipient is written at the front (the slave address), a "stamp" is stuck at the back (the CRC checksum), and letters are separated by the "pauses" between them.

Why It Matters

RTU is the variant with the largest installed base in the field: legacy equipment, serial buses, and interference-heavy workshops all depend on it. The first thing an engineer does when debugging RTU is capture frames and compute the CRC. Being able to say byte by byte "this is the address, that is the low byte of the CRC" puts you in a completely different league from someone who can only copy a tool's output.

Core Concepts: RTU Frame Structure

Address1 byte
PDUFC + data (variable)
CRC-162 bytes
Frames must be separated by a silent interval of ≥3.5 character times

Address: the house number of the target slave (1–247); PDU (Protocol Data Unit): the letter paper, function code + data; CRC-16: a 2-byte checksum. RTU has no length field and relies on a "silence of ≥3.5 character times" to mark frame boundaries—just as people pause to breathe while speaking, and the slave knows from the pause that "the previous sentence is finished".

A Black-Box Understanding of CRC

You do not need to memorize the CRC shift process. You only need to know three things:

  1. CRC-16 uses the polynomial 0xA001 (the bit reversal of 0x8005) over the whole frame (address + PDU) to produce a 2-byte "fingerprint";
  2. It is appended low byte first (C5 first, then 8F);
  3. Verification trick: compute the CRC once more over the "complete frame including its CRC" and the result should be 0x0000—anything else means the frame was corrupted in transit. You can use this trick directly in the Lab.

Protocol Details and Byte-Level Examples

Byte-by-Byte Dissection of an RTU Request

Command: "read 2 holding registers from slave 5, starting at 0x0000" (RTU 8 bytes = address + PDU + CRC):

■ RTU Address ■ Function Code ■ Data ■ CRC
Slave address 05 (1B) 05
FC 03 (1B) 03
Starting address (2B) 00 00
Quantity (2B) 00 02
CRC-16 (2B, low byte first) C5 8F
ByteValueMeaning
005Address
103Function code
2–300 00Starting address
4–500 02Quantity
6–7C5 8FCRC-16 (low byte first)

Note that the CRC is C5 8F (low byte first: C5 then 8F). Compare it with the same command reading slave 1 in Chapter 4, where the CRC is C4 0B—just because the address changed from 01 to 05, the whole CRC changed, which is precisely the "fingerprint" property of the CRC.

RTU Exception Response Frame

When slave 5 is asked to read an address that does not exist, the RTU exception frame (FC 0x83 + exception code 02 + CRC) is: 05 83 02 C0 F1. Function code 0x83 = 0x03 | 0x80, and exception code 02 means "illegal data address".

Real-World Applications

Case 1: Main Storyline—RTU Inside the Greenhouse

Ms. Wang's greenhouse ends up with a hybrid architecture: the 3 devices inside the greenhouse are wired into an RTU network over an RS-485 serial line (cheap, interference-resistant, and good for up to 1200 metres). A gateway converts those RTU frames into TCP and forwards them to the office and to the phone app. RTU handles the reliable acquisition over the "last metre".

Temp sensor ─┐
Exhaust fan ─┼─ RS-485 (RTU) ─▶ [Gateway] ── Ethernet (TCP) ──▶ Office screen / phone
Water pump  ─┘

Case 2: The VFD Side Case—A Fault Alarm Frame

The exception frame from a factory VFD when an illegal address is read is 01 83 02 C0 F1: function code 0x83 tells you "reading holding registers failed", and exception code 02 tells you "the address is out of range". Troubleshooting order: check whether the starting address + quantity entered in the host application exceed the VFD's register range.

Hands-On Lab Guide

  1. Open the Lab page, choose protocol RTU and operation "Read Holding Registers";
  2. Slave address 5, starting address 0x0000, quantity 2 → expected request 05 03 00 00 00 02 C5 8F;
  3. Copy the hex and paste it into the "Parse" area, and confirm each field's breakdown matches this chapter's table;
  4. Take the complete frame (including the CRC) and compute the CRC once more; the result should be 0x0000—that is the verification trick.

Common Misconceptions

Quiz Anchors

  1. Which three parts make up an RTU frame? Which part is responsible for "separating one message frame from the next"?
  2. If you compute the CRC again over a "complete RTU frame containing a correct CRC", what should the result be? Why?
  3. If you change the slave address from 1 to 5, does the CRC change? What property of the CRC does this show?

Chapter Summary and What's Next

In this chapter you learned about the RTU "kraft-paper letter": the three-part structure of address + PDU + CRC-16, framed by 3.5 characters of silence and verified with "CRC over the whole frame = 0". You also saw how changing a single address changes the entire CRC.

In the next chapter we put the same letter into a courier waybill (the MBAP header)—that is the Modbus TCP frame, along with the gateway that connects the two worlds.