Modbus Function Code 17 (Report Server ID): Protocol Specification & Hex Analysis

In industrial SCADA networks, device auto-discovery, firmware inventory tracking, and controller health auditing are critical requirements. While standard telemetry relies on reading analog input or holding registers via FC 03 and FC 04, the official Modbus specification provides a dedicated diagnostic utility: Function Code 17 (0x11 in hex) — Report Server ID (historically termed Report Slave ID).

Unlike fixed-structure register operations, Function Code 17 delivers dynamic hardware identification, program execution status (RUN vs STOP), and vendor-specific operational parameters in a single, compact round-trip exchange. This guide breaks down the official byte specification, hex frame structures, real-world Python implementation, and simulation workflows using ModbusSimulator.

1. Function Code 17 Protocol Specification (Modbus V1.1b3)

According to the Modbus Application Protocol Specification V1.1b3, Function Code 17 is classified under Public Function Codes. It enables a supervisory client to query the identity and operational state of a target server.

Field Byte Length Value / Range Description
Function Code 1 Byte 0x11 (17 Dec) Report Server ID command identifier
Request Data 0 Bytes None No sub-function or address fields needed
Response Byte Count 1 Byte N (Variable) Total bytes following this field (Server ID + Run Status + Additional Data)
Server ID 1 Byte Vendor-specific (e.g. 0x0A) Unique device type or hardware identifier
Run Indicator Status 1 Byte 0x00 or 0xFF 0x00 = OFF / STOP mode; 0xFF = ON / RUN mode
Additional Data N - 2 Bytes ASCII / Hex string Vendor-specific firmware version, serial number, and diagnostic status

2. Modbus RTU Hex Packet Wire Analysis

Let’s examine an actual RS-485 serial communication frame where a PLC master queries a slave device at Address 1 (0x01) using Function Code 17.

Request Frame (Master → Slave):

01 11 C0 2C
  • 01 : Slave Address (Unit Identifier = 1)
  • 11 : Function Code 17 (Report Server ID)
  • C0 2C : CRC-16 Checksum (Low byte 0xC0, High byte 0x2C)

Response Frame (Slave → Master):

The slave device replies with its 1-byte Server ID (0x42), Run Indicator Status ON (0xFF), and a 12-byte ASCII firmware string "MODBUS-SIM-V1":

01 11 0E 42 FF 4D 4F 44 42 55 53 2D 53 49 4D 2D 56 31 7B 92
  • 01 : Slave Address (1)
  • 11 : Function Code 17
  • 0E : Byte Count = 14 bytes (0x0E in hex) following this field
  • 42 : Server ID (0x42 = decimal 66, representing hardware model)
  • FF : Run Indicator Status = 0xFF (Controller is in RUN mode)
  • 4D 4F 44 42 55 53 2D 53 49 4D 2D 56 31 : Additional vendor data in ASCII: "MODBUS-SIM-V1"
  • 7B 92 : CRC-16 Checksum

3. Exception Codes & Error Handling

If the target device does not support Function Code 17 or encounters an internal processing error, it responds with an exception frame where the highest bit of the function code is set (0x11 | 0x80 = 0x91):

  • Exception Code 01 (Illegal Function): The slave controller firmware does not implement Function Code 17. Common on ultra-low-cost energy meters or simplified sensor transmitters.
  • Exception Code 04 (Slave Device Failure): The slave controller’s supervisory watchdog detected internal hardware memory corruption while retrieving identification ROM tables.

4. Python Implementation Using PyModbus

You can test and poll Function Code 17 directly using Python and the pymodbus library over serial or TCP gateways:

from pymodbus.client import ModbusSerialClient

# Connect to Modbus RTU serial port
client = ModbusSerialClient(
    port='/dev/ttyUSB0',  # COM3 on Windows
    baudrate=9600,
    bytesize=8,
    parity='N',
    stopbits=1,
    timeout=1.0
)

if client.connect():
    # Execute Function Code 17 (Report Slave/Server ID)
    response = client.report_slave_id(slave=1)
    
    if not response.isError():
        server_id = response.status  # Server ID byte
        run_status = response.run_status  # 0x00 or 0xFF
        extra_data = response.data.decode('utf-8', errors='ignore')
        
        print(f"Server ID: {server_id}")
        print(f"Run State: {'RUNNING (ON)' if run_status == 0xFF else 'STOPPED (OFF)'}")
        print(f"Device Metadata: {extra_data}")
    else:
        print(f"Modbus Error: {response}")
    client.close()

5. Testing Function Code 17 with ModbusSimulator

Simulating device discovery and fault logic without actual physical controllers is critical during SCADA development. With ModbusSimulator, you can:

  • Configure virtual Modbus RTU & TCP slaves with customizable Server ID bytes (1 to 255).
  • Toggle the Run Indicator byte between 0x00 (STOP) and 0xFF (RUN) dynamically to test SCADA offline alarm triggers.
  • Define custom ASCII hardware model and firmware version strings.
  • Inspect real-time hexadecimal traffic logs showing request/response timings and CRC-16 calculations down to the millisecond.

Test Modbus RTU & TCP Devices in One Unified Software

Download ModbusSimulator for Windows. Includes dual Master and Slave engines, dynamic waveform generation, and SQLite logging.

Download Free 30-Day Trial

Frequently Asked Questions

What is Modbus Function Code 17 (0x11)?

It is the standard Modbus serial command used by masters to query a slave device's hardware identifier, operating run status (RUN/STOP), and manufacturer-specific firmware strings.

What does Run Indicator 0xFF mean?

0xFF indicates that the target PLC or controller is actively executing its logic program in RUN mode. 0x00 signifies STOP or standby mode.

Is Function Code 17 supported on Modbus TCP?

While originally specified for serial communication, many industrial Ethernet gateways and modern PLCs implement FC 17 over Modbus TCP port 502 for network device discovery.