Troubleshooting
Why a CJ2M Modbus RTU master gets no answer from an S7-1200
Short answer
Yes, a CJ2M can poll an S7-1200 over Modbus RTU. The simulators proved each PLC's serial settings, not the cable or the port mode between them: set the Omron port to the mode the MRTU_CPU_Master package requires, bring the send pair onto RDA and RDB for 2-wire operation, load the S7-1200 port at even parity, and confirm the frame on the wire with a known value.
On this page
Yes, a CJ2M can poll an S7-1200 over Modbus RTU; the protocol is not what is failing. Both PLCs answering simulators proves that each PLC's serial settings are valid in isolation — it proves nothing about the port mode, the cable or the polarity between them. Three faults cover nearly all of these silent links: an Omron port mode that does not match the master code in the CPU, a 2-wire bus where the CJ2M's send pair never reaches the wire, and an S7-1200 port that was never loaded with its communication parameters. Fix them in that order, then close the loop with one known value.
What the simulator passes proved #
A simulator runs on a PC adapter with a complete, internally consistent serial interface. Passing with it on each PLC says the baud, parity and stop bits are set consistently on that PLC and that its port can frame Modbus at all. It says nothing about the two things that exist only between the PLCs: whether the CJ2M port mode matches the master code, and whether both ends are truly on one 2-wire bus. Diagnose on the wire, not in the simulator.
Use one documented master method #
Three ways exist to make a CJ2M a Modbus RTU master. Only one is fully documented for this job.
| Method | Where the Modbus frame is built | Verdict for this link |
|---|---|---|
| SCU_Fn03 function block on a Serial Gateway port | The port converts a CPU message into a serial frame | In use now. No published documentation for this block could be located, so its required port mode and addressing cannot be verified. Replace it. |
| Protocol macro sequence | In the serial unit or board | Not running: the port is set to Serial Gateway, and protocol macro is a different port mode. Only one mode is ever active. |
| MRTU_CPU_Master package, published as MRTU_CPU_Master.zip | In the CPU program, from Data Memory tables of up to 100 read and write items | The choice. Published for CP, CJ and CS CPUs, with a manual that states the required port mode. |
Decision: use the MRTU_CPU_Master package, set the port mode its manual names, transfer the settings to the controller, and restart or power-cycle — the mode takes effect only after the restart. While you are in the serial setup, note that the 1:N entry is a setting inside Serial Gateway mode, not a mode of its own; read the mode field itself. If you ever need the opposite arrangement, Omron serial units take the slave role too, as reading Modbus RTU writes into a CJ1W-SCU31-V1 slave area shows.
Bring the Omron send pair onto the bus #
The reported wiring lands only RDA, RDB and FG on the Omron side. An RS-422/485 interface that brings out separate receive and send terminals does not become a 2-wire port on its own: the unit's wiring diagram shows the send pair tied onto the receive pair at the terminal block, and with the send terminals empty the master transmits into nothing. That is exactly the reported symptom — a request that never gets an answer.
The S7-1200 side is already correct for 2-wire: TA jumpered to T/RA and TB jumpered to T/RB join that port's transmit and receive terminals into one half-duplex pair, with M as the reference. Two physical checks remain:
- Polarity. A and B labels are not consistent between vendors. Swap the pair once, deliberately, if the first wiring stays silent.
- Bias and termination. Terminate at the two physical ends of the bus and bias from one point, so the idle differential voltage sits at the RS-485 mark state: B more positive than A by at least 200 mV, the TIA-485 receiver threshold. Make that measurement with the machine in a safe stopped state.
Leave the Omron port at the settings both ends agreed on: 9600 baud, 8 data bits, even parity, 1 stop bit.
Load the S7-1200 port once, run the slave every scan #
The S7-1200 answers nothing until its port is loaded and the slave instruction executes:
- Call Modbus_Comm_Load once at startup with the port, 9600 baud, even parity and a reference to the slave instruction's instance data block. The parity value in that call must select even — the one setting a simulator cannot prove was loaded.
- Call the slave instruction cyclically in the main program cycle (OB1), pointing at a data area sized for every register the CJ2M reads. The area type it accepts is firmware-dependent; the Siemens documentation for your firmware states it.
- Function code 03 reads holding registers, and request start address 0 maps to the first element of that area, so holding register 40001 is element 0.
Check each hop until the response returns #
Work down this list in order; each entry names the failure signature that points to it:
- Port mode. The mode field in the CJ2M serial setup matches what the master package requires, and the controller was restarted after the settings transfer. Signature of a miss: no frame ever leaves the port.
- Omron transmit path. The send pair is tied onto RDA and RDB per the unit's wiring diagram. Signature: the master transmits into nothing and the slave shows no receive activity.
- Pair polarity. Swap the pair as a test. Signature: the slave receives garbage and stays silent, or logs CRC errors.
- Bias and termination. Ends terminated, one bias point. Signature: intermittent or noise-corrupted frames when the bus idles.
- Serial parameters. Both ends at the agreed settings, with the parity value in the load call set to even. Signature: framing or parity errors on every frame.
- Slave address and register map. The unit ID in the master's table equals the S7-1200's slave address, and the start address falls inside the pointed area. Signature: no response for a wrong ID, an exception answer for a bad address. Address 0 is broadcast, which is its own failure mode — why Modbus RTU sends to slave address 0 instead of your device covers it.
One worked read: what must appear on the wire #
Read two holding registers from slave address 1: function code 03, start address 0, count 2. The request is 8 bytes — slave address 01, function 03, start 00 00, count 00 02, 2-byte CRC. The response is 9 bytes: 01 03 04, four data bytes, 2-byte CRC, where the byte-count field is 2 bytes per register × 2 registers = 4.
Timing, at the settings above: one character carries 1 start + 8 data + 1 parity + 1 stop = 11 bits, so at 9600 bit/s a character takes 11 ÷ 9600 s = 1.15 ms. The request holds the bus for 8 × 1.15 = 9.2 ms and the response for 9 × 1.15 = 10.3 ms, and the Modbus RTU specification requires at least 3.5 character times of silence between frames — 3.5 × 1.15 = 4.0 ms. An analyzer that shows the request but no response points at the slave address, the loaded parity, or a slave instruction that is not executing; an analyzer that shows nothing at all points back at the port mode and the send-pair wiring.
Close the loop with data: write 12345 into the first element of the slave area (an illustrative test value) and confirm the CJ2M's destination word reads 12345 on the next poll. If a neighboring word picks it up, the master table's address basis is off by the offset you observe.
The decision for each case #
- Nothing on the wire: port mode or send-pair wiring. Use MRTU_CPU_Master with its documented mode, tie the send pair onto RDA and RDB, transfer, restart.
- Request visible, no answer: unit ID, loaded parity, or the slave instruction not running cyclically in OB1.
- Exception answer: the register map — move the start address or resize the slave area.
- Value in the wrong word: correct the master table's address basis with the 12345 test.
Once the poll runs, the pace you can expect from one serial port is the next question, and why Modbus RTU drive polling on one serial port is slow covers it.
Questions asked
Why do both PLCs answer Modbus simulators but not each other?
The simulator runs on a PC adapter with its own complete transmit and receive wiring, so a pass proves each PLC's serial settings in isolation and nothing about the link between them. Hang the simulator on the actual two wires: if the CJ2M request appears there, the Omron transmit path is fine and the fault is on the S7-1200 side; if it does not, the send pair is still not on the bus.
Why must TA be jumpered to T/RA and TB to T/RB on the S7-1200?
That port brings out separate transmit and receive terminals, and the two jumpers join them into one half-duplex pair, the only arrangement a 2-wire master can share. Without the jumpers the port behaves as a 4-wire interface that expects the master's send pair wired to its receive pair, so a 2-wire CJ2M request never arrives at all.
Why will a Serial Gateway port not run a protocol macro sequence?
Port mode is a single setting in the serial setup: Serial Gateway, protocol macro and the others are alternatives, and only one is active at a time. A sequence built for protocol macro never executes on a port set to Serial Gateway. For the reverse arrangement, where the Omron PLC answers as the slave, the companion MRTU_CPU_Slave package covers that role.
What should the analyzer show for a two-register read from slave address 1?
The request is 8 bytes: address 01, function 03, start address, register count and a 2-byte CRC. The response is 9 bytes: 01 03 04, four data bytes and the CRC. Silence with a valid request on the bus points to the slave address or parity; an exception frame, the function code with its top bit set, points to the register map.
How is the CJ2M side set for 2-wire RS-485?
Two things, both from the unit's own documentation: select 2-wire operation in the serial setup as its manual describes, and jumper the send terminals onto RDA and RDB at the terminal block exactly as its wiring diagram draws. The S7-1200 makes the same join internally with its TA to T/RA and TB to T/RB jumpers. One without the other still leaves one side transmitting into nothing.