Modbus RTU CRC & Frame Analyser
Also known as Serial Protocol Analyser
Calculate the Modbus RTU CRC, decode Modbus and other serial frames, and find which CRC a device uses.
Free to use. Sign up free to save, download and print.
Loading the Modbus RTU CRC & Frame Analyser…
What it produces
Modbus RTU frame decoder and CRC calculator
The analyser reads a Modbus RTU frame field by field: the slave address, the function code, the data and a two byte CRC. It checks the CRC, names the function, decides from the function code and the length of the data whether the frame is a query, a response or an exception, and lays out register and coil values. Where a query and a response would look the same, it says so. It decodes NMEA 0183, MAVLink, CAN with J1939, DMX512 and M-Bus frames as well.
The Modbus RTU check is CRC-16/MODBUS: the polynomial 0x8005 with each byte and the result bit reversed (0xA001 when the register shifts right), a starting value of 0xFFFF and no final XOR, over every byte before the CRC. The CRC goes on the wire low byte first. The same view calculates any CRC in its catalogue and searches the catalogue for the algorithm behind a known check value.
Standards
- Modbus over Serial Line V1.02: Modbus RTU framing, CRC-16 and character timing
- Modbus Application Protocol Specification V1.1b3: function code request and response layouts (§6) and exception codes (§7)
- NMEA 0183 sentence checksum
- MAVLink version 1 and 2 framing and CRC
- SAE J1939 parameter group numbers carried in CAN identifiers
- ANSI E1.11 (DMX512): start codes per the ESTA alternate START code registry, and slots
- EN 13757-2 (M-Bus): frame types and checksum
- TIA-232-F, TIA-422-B and TIA-485-A driver and receiver levels; TIA-485 32 unit load limit
- JEDEC JESD8C.01 (LVTTL) and JESD8-7A (1.8 V CMOS) logic levels
Sample
Sample: decoding 01 03 00 00 00 0A C5 CD
A Modbus RTU master asks slave 1 for ten holding registers from address 0, and the analyser is given the eight bytes it sent.
| Bytes | Field | Decoded |
|---|---|---|
| 01 | Slave address | 1 |
| 03 | Function code | Read Holding Registers, a query |
| 00 00 | Starting address | 0 (0x0000) |
| 00 0A | Quantity | 10 registers |
| C5 CD | CRC, low byte first | CDC5, CRC OK |
Sent high byte first, as CD C5, the same frame fails the check and the analyser shows the CRC it expected, CDC5. Any CRC-16/MODBUS routine gives 4B37 for the ASCII text 123456789, the published check value for this CRC.
How is the Modbus RTU CRC calculated?
Modbus RTU uses CRC-16/MODBUS. A 16 bit register starts at 0xFFFF. Each byte from the slave address to the end of the data is XORed into its low byte, and the register is shifted right eight times, XORed with 0xA001 whenever a 1 falls out. The result is sent low byte first, so a CRC of CDC5 goes on the wire as C5 CD. The analyser calculates it from bytes you paste and checks it on every Modbus frame it decodes.
How does the Modbus RTU interpretation work?
The analyser checks the CRC-16 at the end of the frame, then uses the function code and the length of the payload to decide whether the frame is a query, a response or an exception, using the request and response layouts in the Modbus Application Protocol Specification. A single write and its reply are identical, so it shows them as a query or its echo. Register and coil values from reads and multiple writes are laid out as tables, and exception responses are shown with the exception name and a plain explanation of the likely cause.
How does the reverse CRC search work?
You enter the frame bytes and the check value the device produced. The analyser runs the frame through every algorithm in its CRC catalogue and lists the ones that give the same value, which usually identifies the integrity check a vendor protocol is using.
Which browsers support live capture?
Live capture uses the Web Serial interface, which is available in Chromium based browsers such as Chrome and Edge on a secure connection. Firefox and Safari do not support it at present, but data can still be imported from a CSV file or pasted in on those browsers.
Can I import a capture from a logic analyser?
Yes. The analyser accepts asynchronous serial CSV exports, such as those from Saleae Logic 2, with byte values in hex or decimal. Timestamps are kept with each byte, and framing and parity errors recorded in the export are flagged.
Is my captured data sent to a server?
No. Capture, decoding and CRC calculation run in your browser. The current session is kept in your browser's local storage, and a share link carries the session in the link itself.
Sign up free to keep your work.
Free to use. Saving, downloading and printing need a free account.