FX5U Modbus TCP Client Setup in GX Works 3: Fixing Error 2822H

Ryan Tanaka11 min read
GX WorksMitsubishiTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

FX5U Modbus TCP Client Setup in GX Works 3: Fixing Error 2822H

Field-proven configuration: When connecting a Mitsubishi MELSEC iQ-F FX5U CPU as a Modbus TCP client to a third-party PLC or distributed I/O (Crevis, Advantech, Wago, etc.), the most common commissioning failure is the wrong protocol selector under Ethernet Port Parameter Configuration. Choosing "UDP Connection Module" instead of "Active Connection Module" triggers the GX Works 3 parameter validator fault 2822H ("Device that cannot be specified is specified") and a runtime C410 receive-wait timeout with TCP status = Disconnected. This reference documents the correct setup using the Predefined Protocol Support function, including module setup, active connection logic, and the diagnostic workflow to verify exchanges against a remote Modbus TCP server on TCP port 502.

1. Overview

The MELSEC iQ-F FX5U series provides built-in 100 Mbps Ethernet on every CPU variant (FX5U-32M, FX5U-64M, FX5U-80M) plus the FX5UC compact variants when paired with an FX5-ENET or FX5-ENET/IP module. Modbus TCP client functionality is delivered through the Predefined Protocol Support function documented in Section 6 of the FX5 User's Manual (Ethernet Communication) – JY997D56201 and the Modbus-specific reference MELSEC iQ-F FX5 User's Manual (MODBUS Communication) – JY997D56101H.

Unlike SLMP or MC protocol exchanges, the Predefined Protocol block lets the FX5U dispatch native Modbus function codes (FC03, FC06, FC10, FC17, etc.) directly from structured ladder or ST without manual byte parsing of the Application Data Unit (ADU). This makes integration with non-Mitsubishi Modbus TCP servers practical in a single CPU scan.

2. Prerequisites

Item Required Specification
CPU module FX5U-32M, FX5U-32MR/DS, FX5U-64MT/DSS, FX5U-80MT/DSS, or FX5UC with FX5-ENET attached
CPU firmware Ver. 1.060 or later (Predefined Protocol Support is firmware-gated; Ver. 1.110+ recommended for FC17 multi-register R/W)
Engineering tool GX Works3 Ver. 1.060N or later (Ver. 1.085P+ recommended)
Built-in Ethernet port CH1 (default) or CH2 (FX5-ENET, second port base)
Target device Any Modbus TCP server bound to TCP port 502 (Crevis S-Series, Schneider M340, Wago 750, generic gateway, etc.)
Cabling Cat5e or higher; FX5U supports Auto-MDI/MDIX so straight-through cables work for both switch and direct connections
IP scheme FX5U on same subnet as target (e.g., FX5U 192.168.0.10 / 255.255.255.0; target 192.168.0.81)
Verify CPU firmware under NavigationModule Information → right-click CPU module → Module Diagnostic (CPU Diagnostics)Product Information. The Predefined Protocol Support function requires the dedicated protocol library registration described in Section 5 of this article; it is not a native block in earlier firmware.

3. Network Topology

The reference deployment places the FX5U as the TCP active opener (client) initiating the connection to a fixed remote Modbus TCP server. Switched Ethernet is assumed; a router or NAT is not used because the FX5U does not support outbound NAT traversal for the Predefined Protocol block.

FX5U-64MT/DSS CPU 192.168.0.10 CH1 (built-in) Predefined Protocol Active TCP Client Ethernet Switch Modbus TCP Server (e.g., Crevis S-IO) IP 192.168.0.81 TCP Port 502 Unit ID 1

4. GX Works 3 Project and Module Configuration

  1. Launch GX Works 3 and create a new project. Select Series = MELSEC iQ-F, CPU Type = FX5U, and match the actual CPU model (e.g., FX5U-64MT/DSS). Choose Program Language = Ladder or Structured Text.
  2. Open NavigationParameterFX5UCPUModule ParameterEthernet Port.
  3. Set the IP Address field for CH1 (e.g., 192.168.0.10) and Subnet Mask (255.255.255.0). Leave Default Gateway blank if no router is used.
  4. Confirm Communication Speed is set to Auto-Negotiation (100 Mbps / Full Duplex will autonegotiate on most managed switches).
The Ethernet Port settings affect all protocols on that channel (MC, SLMP, MODBUS/TCP, SOCKET). When the FX5U is also serving as an HMI gateway on the same port, plan connection limits accordingly. The default channel supports 8 simultaneous connections; FX5-ENET extends this to 16+16.

5. Ethernet Port Parameter Configuration – The Active Connection Fix

This is the decisive step that resolves error 2822H. In GX Works 3:

  1. Navigate to ParameterFX5UCPUModule ParameterEthernet PortBasic SettingsOwn Node Settings.
  2. Expand Application SettingsPredefined Protocol Settings (or, depending on GX Works 3 build, Ethernet Port Parameter Configuration).
  3. Select the row for the protocol set assigned to your target server. Under Protocol Type choose TCP, not UDP.
  4. Under Connection Type select Active Connection Module. Do not select UDP Connection Module – that option is for datagram services and produces fault 2822H on parameter validation when a Modbus ADU stream is bound to it.
  5. Set Destination IP Address = 192.168.0.81, Destination Port No. = 502 (decimal), and Source Port No. = any unused port (e.g., 1282 or a calculated free port from the IANA dynamic range).
  6. Click Apply. If the validator still raises 2822H, the most likely cause is a residual entry in Passive Connection Module or UDP Connection Module on the same connection number – delete the obsolete rows first.
Selector Value Transport Initiates Connect? Use for Modbus TCP?
Active Connection Module TCP Yes (client) Yes – correct choice
Unpassive Connection Module TCP No (server) Only if FX5U is the Modbus server
Fullpassive Connection Module TCP No (full server) Only if FX5U is the Modbus server
UDP Connection Module UDP N/A No – causes 2822H on Modbus TCP
The error code 2822H is decoded in the GX Works 3 help under SP.UNITERR / parameter validation. For Predefined Protocol rows, it indicates the configured transport cannot carry the protocol's PDU format. UDP lacks the connection state Modbus TCP expects; the parameter check refuses the binding before the PLC is allowed to run.

6. Predefined Protocol Support Function – Protocol Library

Register the Modbus TCP protocol set in the protocol library before the Predefined Protocol block can be called from ladder:

  1. Open ToolProtocol LibraryPredefined Protocol Library from the menu bar.
  2. Select Add and choose Modbus/TCP Master from the vendor-supplied library. GX Works 3 ships M+CPU_PreDefModbusMaster_Vxxx.zip; if absent, download from the Mitsubishi FA site.
  3. Define one or more Protocol Entries – each entry maps to one Modbus function code. Typical set:
    • Entry 1: FC03 (Read Holding Registers), variable-length, payload up to 125 registers
    • Entry 2: FC06 (Write Single Register)
    • Entry 3: FC10h (Write Multiple Registers), payload up to 123 registers
    • Entry 4: FC17h (Read/Write Multiple Registers), payload up to 121 read + 121 write registers
  4. Bind each entry to the connection number configured in Section 5.

7. Ladder-Side Invocation Example

Use the SP.ECPRTCL instruction to dispatch the protocol entries. A minimal ST example (compatible with FX5U Ver. 1.060+) that issues FC17 (Read/Write Multiple Registers) every 100 ms:

// Inputs
VAR
    bStart        : BOOL;          // Start trigger
    wChannel      : WORD := 1;     // Connection number 1
    wProtocolNo   : WORD := 4;     // Protocol entry 4 = FC17
    wReadAddr     : WORD := 16#0000; // Modbus address 0
    wReadQty      : WORD := 8;     // Read 8 holding regs
    wWriteAddr    : WORD := 16#0100; // Write start 256
    wWriteQty     : WORD := 8;     // Write 8 regs
    wUnitID       : WORD := 1;     // Modbus Unit ID 1
    wDone         : WORD;
    wError        : WORD;
END_VAR

IF bStart THEN
    SP_ECPRTCL(
        i_ConnNo      := wChannel,
        i_ProtocolNo  := wProtocolNo,
        i_UnitId      := wUnitID,
        i_ReadAddr    := wReadAddr,
        i_ReadQty     := wReadQty,
        i_WriteAddr   := wWriteAddr,
        i_WriteQty    := wWriteQty,
        o_Done        => wDone,
        o_Error       => wError
    );
END_IF;

The Predefined Protocol block handles the MBAP header construction (Transaction ID, Protocol ID 0, Length, Unit ID) and the FC17 PDU assembly automatically. Bind the resulting registers into device memory ranges D1000..D1015 for read and D2000..D2015 for write.

8. Error Code Reference

Code Origin Meaning Resolution
2822H GX Works 3 parameter validator Device/protocol cannot be specified in this transport Switch protocol row from UDP to TCP + Active Connection Module
C410 FX5U runtime Receive waiting time timeout – no Modbus response Check target IP, port 502 reachability, firewall; increase SP.SOCTRL timeout
C411 FX5U runtime Connection not established Verify active connection configuration and link state
C412 FX5U runtime Disconnected during send Inspect target server; confirm keep-alive settings
C414 FX5U runtime Send timeout Reduce concurrent connection count, check Ethernet load
C415 FX5U runtime Connection number error Connection number out of range; bind to a valid 1..8 (CH1)
C416 FX5U runtime Protocol library missing Re-register the Modbus/TCP Master library
C417 FX5U runtime Protocol number error i_ProtocolNo exceeds entries in protocol set
C418 FX5U runtime Send data size error Reduce FC10/FC17 write quantity to ≤123 / ≤121 registers
C419 FX5U runtime Protocol definition error Reload the protocol library and re-bind entries
0x0B Modbus exception Gateway target device failed to respond Verify remote slave Unit ID and register window
0x02 Modbus exception Illegal data address Check address range vs. server map

9. Diagnostic Workflow

  1. From GX Works 3, select OnlineEthernet Diagnosis. Confirm the connection row shows Status = Connected and System = Active Open Complete.
  2. If Status remains Disconnected, open Module Diagnostic on the Ethernet port and check Open Error Log. Look for 2822H entries – they indicate the parameter validator rejected the active open attempt.
  3. Use Device Memory Monitor on the binding area (D1000..D1015). Each FC03 / FC17 read should populate the read window within the configured timeout (default 3 s; configurable in Predefined Protocol SettingsCommunication Timeout).
  4. Capture a packet trace with Wireshark on a SPAN port of the managed switch. Filter for tcp.port == 502. Verify the FX5U issues a proper SYN to 192.168.0.81:502 and that the server responds with SYN-ACK; an immediate RST indicates the server is not bound to port 502 or is on a different VLAN.
  5. Force a single FC03 read with Protocol Execution Tool (bundled in the protocol library) to isolate ladder logic faults from parameter faults.

10. Verification Procedure

  1. Write a single test register (FC06) to holding register 0x0000 with value 16#0001. Confirm the server registers the write.
  2. Read register 0x0000 (FC03, qty=1) and verify the response value equals 16#0001.
  3. Run FC17 with qty=8 read from 0x0000 and qty=8 write to 0x0100, looped 100 times. Confirm zero SP_ECPRTCL errors and zero C4xx runtime faults.
  4. Power-cycle the FX5U and confirm the active connection re-establishes within the configured Reconnect Interval (default 2 s) without manual intervention.

11. Troubleshooting Matrix

Symptom Likely Cause Action
2822H at parameter write UDP Connection Module selected for Modbus TCP Change to Active Connection Module
TCP status Disconnected Wrong destination IP / port; firewall on server Ping target; telnet 192.168.0.81 502 from PC
C410 receive timeout No response from server or wrong Unit ID Verify server is on Unit ID 1; increase timeout to 5000 ms
C411 not established Active connection not yet opened at scan startup Add a 1 s warm-up delay before first SP_ECPRTCL
C415 connection number error Channel number outside CH1's range Use 1..8 for CH1 (built-in); 9..16 if FX5-ENET CH2
C416 protocol library missing Library not registered to project Re-add the Modbus/TCP Master library, re-compile
Modbus exception 0x02 Read/write address beyond server map Cross-check against server register table
Reads succeed but writes return 0x0B Server routing issue with gateway Confirm FX5U is not behind a NAT; set static IP
Intermittent disconnects every 60 s Server TCP keep-alive shorter than FX5 timeout Set server keep-alive to 120 s or extend FX5 timeout
Compile warning about unused connection Passive row leftover after refactor Delete the passive row to clear the warning

12. Field Notes and Best Practices

  • Always ping the target server from a laptop on the same subnet before commissioning the FX5U. Many 2822H-style faults are downstream of a simple Layer 3 mismatch.
  • Reserve source port 1282 or higher; ports below 1024 on the FX5U side may conflict with system services on the CPU. The IANA dynamic range (49152..65535) is recommended for greenfield designs.
  • For mixed-vendor deployments (e.g., FX5U ↔ Schneider M340 ↔ Wago 750), maintain a connection number map – each Modbus target gets its own connection number 1..8 on CH1.
  • Document the protocol numberfunction code mapping inside the GX Works 3 project header comments. This prevents future maintenance engineers from confusing FC03 (Read Holding) with FC04 (Read Input) when adding new entries.
  • When using FX5-ENET (separate module), the second channel is configured independently under FX5-ENET in Navigation. Active Connection Module must be re-selected on each module's parameter page.
  • For safety or SIL-rated I/O (e.g., Crevis S-IO), confirm the Predefined Protocol block does not collide with the CC-Link IE Field Basic slot the safety device is bound to. Separate channels are recommended for safety vs. standard Modbus TCP traffic.
  • Always update both CPU firmware and GX Works 3 to the latest matched versions before commissioning; cross-version mismatches are a common source of intermittent C4xx faults that disappear after a coordinated update.

What causes error 2822H when configuring FX5U as a Modbus TCP client?

Error 2822H is raised by the GX Works 3 parameter validator when the protocol row is bound to a UDP Connection Module but the protocol (Modbus TCP) requires a TCP transport. Switch the row's Connection Type to Active Connection Module and re-compile to clear the fault.

How do I fix C410 receive waiting time timeout on the FX5U Modbus TCP client?

C410 indicates the FX5U sent a Modbus request but received no response within the configured receive wait time (default 3 s). Verify the target IP, TCP port 502 reachability, server Unit ID, and increase Communication Timeout under Predefined Protocol Settings to 5000 ms during commissioning.

Which connection type should I select – Active, Unpassive, or Fullpassive?

For an FX5U Modbus TCP client, always select Active Connection Module so the CPU initiates the TCP three-way handshake to the server. Unpassive and Fullpassive modes are for Modbus TCP servers where the FX5U accepts inbound connections.

What is the maximum number of Modbus registers I can read or write per request?

Modbus TCP allows up to 125 holding registers per FC03 read and up to 123 registers per FC10 write. The FC17 Read/Write Multiple Registers function supports up to 121 read + 121 write registers in a single transaction. Exceeding these limits triggers FX5U runtime error C418.

Do I need a separate Ethernet module to use Modbus TCP on the FX5U?

No. Every FX5U CPU has a built-in 100 Mbps Ethernet port (CH1) that supports Modbus TCP via the Predefined Protocol Support function. An FX5-ENET or FX5-ENET/IP module is only required if you need a second isolated channel or additional simultaneous connections.

Back to blog