Problem Overview
Serial Host Link communication to an Omron CJ1M-CPU13 or CJ1M-CPU22 from a PC produces inconsistent results, dropped frames, or full timeouts. The CPU ships with both an RS232C port (DB-9, lower port) and a peripheral port (mini-DIN, upper port) installed, but their default protocols differ, and a single wrong DIP switch or cable choice can break the link. The symptom is identical whether the PC uses a native COM port, a USB-to-RS232 converter, or the USB-to-peripheral cable USB-CN226.
The two port personalities at default are:
- Peripheral port (upper mini-DIN): Toolbus, auto-baud — only CX-Programmer / CX-Integrator can use it out of the box.
- RS232C port (lower DB-9): Host Link (Sysmac Way), 9600 bps, 7 data bits, even parity, 2 stop bits (default).
If you attempt Host Link frames on the peripheral port without enabling it, or you mix a Toolbus-capable port with a Host Link frame, the PLC stays silent and the host times out. Adding a second cable in parallel sometimes appears to work, but it is coincidence: the second cable forces a different routing through Windows COM enumeration and accidentally selects the port that the PLC is actually answering on.
Root Cause Analysis
Three independent root causes combine to produce the reported symptoms:
- Port mode mismatch. The peripheral port is factory-set to Toolbus. A Host Link request frame (@00RR0000000141*\r) sent to a Toolbus port gets no reply, producing a host-side timeout. The lower DB-9 port is the only one that talks Host Link by default.
- DIP switch 4 not set. DIP switch 4 on the CJ1M CPU selects whether the peripheral port uses its default protocol (Toolbus) or a user-defined serial mode. With SW4 OFF, the peripheral port will not enter Host Link even if CX-Programmer is used to change the port mode parameter; the change is only applied after SW4 is ON and the PLC power is cycled.
- USB-to-serial converter timing. CH340, FTDI, and Prolific-based converters introduce 20-200 ms of latency and occasionally drop characters at the 16-byte Host Link frame boundary. The SuperMon-style hand-shake therefore succeeds on retries and fails on others, producing the reported 1-in-10 success rate under LabVIEW with VISA.
The "works only with both cables plugged in" symptom is a Windows COM port enumeration artifact: a connected cable creates a stable COM handle (e.g., COM6 for the lower port, COM9 for the upper port) and re-enumerating an unplugged cable can shift the COM number the application is actually opening. The PLC does not require both cables; the host does.
Hardware Reference: CJ1M CPU Ports and Switches
The CJ1M-CPU13/22 units ship with two on-board serial ports and a bank of four DIP switches on the front face. The faceplate layout is shown below.
Switch assignments per the CJ1M CPU Units Operation Manual (W395) family:
| Switch | Function | Position | Result |
|---|---|---|---|
| SW1 | Write-protect DIP for user program | OFF | Program write-enabled (default) |
| SW2 | Not used (reserved) | OFF | — |
| SW3 | Not used (reserved) | OFF | — |
| SW4 | Peripheral port protocol select | ON | Use the serial mode set in PLC Setup (e.g., Host Link) |
| SW4 | Peripheral port protocol select | OFF | Use Toolbus (CX-Programmer default) |
DIP Switch Configuration Procedure
Follow this sequence to put the CJ1M peripheral port into Host Link mode for use with a USB-CN226 cable or a USB-to-DB-9 converter on the lower port.
- Power the CPU off. DIP switches are only read at power-on.
- Set SW4 to ON. Leave SW1, SW2, SW3 OFF unless the program must be write-protected (SW1 ON).
- Power the CPU on. Observe that the RD/SD LEDs on the peripheral port do not flicker — this is normal until the first frame is received.
- Connect CX-Programmer via USB-CN226 (peripheral) or XW2Z-200S-CV (DB-9). Open the PLC and double-click Settings -> Host Link Port in the project tree.
- Confirm Serial Communications Mode = Host Link. If you are configuring the peripheral port, also confirm Port = Peripheral. If the parameter is greyed out, SW4 is still OFF — cycle power again.
- Confirm Baud rate = 9600, Data bits = 7, Stop bits = 2, Parity = Even. These are the Host Link defaults and match the Sysmac Way specification.
- Transfer the new Setup to the CPU. The peripheral port is now ready for Host Link traffic.
Serial Communication Parameters
Host Link (also called Sysmac Way, C-mode, or SYSWAY) is a half-duplex, ASCII, master-slave protocol. The default parameter block the CJ1M ships with is:
| Parameter | Default value | Notes |
|---|---|---|
| Baud rate | 9600 bps | 300 / 600 / 1200 / 2400 / 4800 / 9600 / 19200 / 38400 / 57600 / 115200 also supported |
| Data bits | 7 | ASCII frames only |
| Stop bits | 2 | 1 also valid but unusual on CJ1M |
| Parity | Even | None / Odd / Even selectable |
| Node number | 00 (broadcast for some commands) | 0-31 (00 default) on the RS232 port; 0-15 on peripheral port |
| FCS check | Enabled | 1-byte frame check sum, two ASCII hex characters |
| End code return | Enabled | PLC returns end code on read/write errors |
A minimal Host Link read request and reply frame (CIO area, word 0x0000):
Sent: @00RR0000000141*<CR>
Received: @00RR00000040*<CR>
Decoded:
-
@— start of text (always 0x40) -
00— destination node (00 is the local PLC by default) -
RR— command: Read CIO area -
0000— starting word (CIO 0) -
0001— number of words to read (1) -
41— FCS byte (two ASCII hex chars) -
*<CR>— terminator
The reply @00RR00000040*<CR> contains the end code 00 (normal completion) and the read value 0040 (decimal 64).
Cable Selection
Three cable classes are in field use with the CJ1M. The table summarises behaviour, part numbers, and known gotchas.
| Cable / converter | Port on CJ1M | Driver | Behaviour | Recommendation |
|---|---|---|---|---|
| USB-CN226 (Omron) | Peripheral (upper mini-DIN) | Omron SYSMAC USB CDC driver | Emulates a true COM port; works with SW4 = ON and Host Link mode | Recommended for laptops without RS232 |
| XW2Z-200S-CV (Omron) | RS232 DB-9 (lower) | None (native COM) | Shielded 2 m Host Link cable with built-in shielding and ground | Best for fixed installations |
| CS1W-CIF31 (Omron) | RS232 DB-9 (lower) | Omron USB-Serial driver | USB-to-RS232 converter module; reports as a real COM port | Use when the PC has no native DB-9; preferred over generic converters |
| Generic USB-to-DB-9 (Prolific / CH340 / FTDI) | RS232 DB-9 (lower) | Windows / manufacturer driver | Intermittent Host Link errors due to latency and buffer size | Avoid for production; OK for bench tests |
| PCMCIA / ExpressCard RS232 | RS232 DB-9 (lower) | OEM driver | Native UART, no buffer issues | Second-best to a built-in port |
Verifying the Link with the Omron Host Link Tool
After the DIP switch and PLC Setup changes, validate the link with the official Omron utility before touching custom code.
- Download and install the Omron Host Link Request Tool from the Omron utility downloads section. It is bundled with CX-Programmer 9.x and later.
- Launch the tool. Set Port to the COM number the USB-CN226 or CS1W-CIF31 enumerated as (Device Manager -> Ports).
- Set Baud = 9600, Data = 7, Stop = 2, Parity = Even, Unit No. = 0.
- Click Open Port. Confirm the green status indicator appears.
- Click Add, pick RR (CIO Read), enter starting word 0 and word count 1. Press Request.
- Expected reply:
@00RR00 0000 00 0040 *<CR>(end code 00, value 64 if the CPU is idle in MONITOR mode).
If the tool returns an end code 13 (FCS error) or 14 (format error), the most common cause is the PC serial driver stripping the high bit of the FCS characters. Switch the COM port Data bits to 7 and confirm Parity = Even in Device Manager as well as in the application.
Interfacing from LabVIEW, Python, and C#
Custom applications must open the COM port and own its lifetime before the first Host Link frame is sent. Closing and reopening the port between every transaction doubles the round-trip time and is the cause of the reported 1-in-10 success rate under VISA.
LabVIEW VISA example flow (pseudocode for a state machine):
State 0: VISA Open (resource = "COM6")
VISA Configure Serial Port:
baud = 9600, data bits = 7, parity = 2 (Even), stop bits = 2, flow = None
VISA Set I/O Buffer Size: in=4096, out=4096
VISA Set I/O Timeout: 2000 ms
-> State 1
State 1: VISA Write ("@00RR0000000141*\r")
-> State 2
State 2: VISA Bytes at Serial Port -> if > 0: VISA Read (count=64) -> parse FCS
else if timeout: retry up to 3 times, then State 99 (error)
-> State 0 only on user request to close
Python example using pyserial:
import serial
ser = serial.Serial('COM6', baudrate=9600, bytesize=7,
parity=serial.PARITY_EVEN, stopbits=2, timeout=1.0)
ser.write(b'@00RR0000000141\r')
reply = ser.readline() # reads up to '\n' or timeout
print(reply.decode('ascii'))
ser.close()
.NET (C#) example using System.IO.Ports.SerialPort:
var sp = new SerialPort("COM6", 9600, Parity.Even, 7, StopBits.Two);
sp.Open();
sp.Write("@00RR0000000141\r");
string reply = sp.ReadLine(); // ReadLine honours '\r' terminator
Console.WriteLine(reply);
sp.Close();
USB-to-Serial Converter Best Practices
Modern laptops ship without a DB-9 port. The path of least resistance is a USB-to-serial converter, but the wrong part will eat frames silently. Apply these rules:
- Use Omron CS1W-CIF31 first. It uses the Omron USB-Serial driver and emulates a true 16550 UART.
- If a generic converter is unavoidable, pick an FTDI-based part (FT232R or FT231X). CH340 and Prolific PL2303 are known to drop characters at the 16-byte Host Link boundary on Windows 10 and 11.
- Disable COM port power management in Windows: Device Manager -> Ports -> Properties -> Power Management -> uncheck "Allow the computer to turn off this device to save power".
- Set the COM port FIFO buffer to its lowest setting. Some converters default to a 14-byte trigger level that overflows when the CPU replies with the 15- or 17-byte read response.
- For applications that must run unattended, prefer a PCMCIA / ExpressCard serial card. Two native COM ports cost less than one CS1W-CIF31 and are immune to USB suspend.
Differences Between CJ1M Revisions
The source reports inconsistent behaviour between a CJ1M Rev 2 (CPU13) and a CJ1M Rev 3 (CPU22). Both units ship with Host Link enabled by default on the RS232 port at 9600, 7, E, 2, but the peripheral port default protocol and the FINS header differ across revisions. A third-party HMI that hard-codes a Rev 2 FINS header will fail on a Rev 3 unit, and vice versa. Always set the Host Link FINS source/destination unit numbers explicitly in the application and use CX-Programmer's Compare tool to verify the active PLC Setup against the project before commissioning.
For details on the Ethernet-equipped variants (CJ1M-CPU13-ETN / CPU22-ETN / CPU23-ETN) and their FINS-over-TCP behaviour, see the CJ1M-CPU1@-ETN datasheet (PDF).
Troubleshooting Matrix
| Symptom | Most likely cause | Fix |
|---|---|---|
| No reply on peripheral port, CX-Programmer connects | DIP SW4 is OFF; peripheral port is still Toolbus | Power off, set SW4 ON, power on, re-transfer PLC Setup |
| No reply on lower DB-9, RD/SD LEDs dark | Wrong COM port, or cable is null-modem instead of straight | Use Omron XW2Z-200S-CV or a pin-2/3 straight cable; verify COM number |
| 1-in-10 success rate under VISA / LabVIEW | USB converter latency or COM port closed between calls | Open the port once, leave it open, lower FIFO trigger level, switch to CS1W-CIF31 or PCMCIA card |
| End code 13 (FCS error) | Stripped parity, wrong data bits, or \r\n terminator sent | Set 7/E/2 in both application and Device Manager; send \r only |
| End code 14 (format error) | Node number mismatch or wrong command code for the address range | Verify unit number matches PLC Setup; use RD/WR for DM, RR/RW for CIO |
| End code 02 (excessive command length) or 03 (insufficient length) | Frame built without leading @ or trailing *\r | Use a reference Host Link frame and compare character-by-character |
| Works only when both ports are cabled | Windows COM enumeration shifting on cable unplug | Disable unused COM ports in Device Manager; assign fixed COM numbers via USB enumeration overrides |
| Communication fine, third-party HMI times out on VFD | 3G3MV / 3G3JV inverter Host Link implementation differences | Drop baud to 19200, add 50 ms inter-character delay, or use a PCMCIA card in place of CIF31 |
End-to-End Commissioning Checklist
- Confirm CPU model and revision label on the side of the unit (CJ1M-CPU13 vs CPU22 vs ETN variants).
- Set DIP SW4 = ON for peripheral-port Host Link; leave OFF if using the DB-9 port only.
- Open CX-Programmer, transfer the project, and verify Host Link Port setup = 9600 / 7 / E / 2.
- Use the Omron Host Link Request Tool to send a
RR00000001read and confirm end code 00. - Lock the COM port number in Device Manager (USB enumeration override if needed).
- Open the application COM port once, keep it open, and verify round-trip latency under 50 ms per transaction at 9600 bps.
- Document the cable part number on the panel drawing for future maintenance.
With DIP SW4 = ON, the peripheral port in Host Link mode, and a stable 9600 / 7 / E / 2 connection, the CJ1M CPU13 and CPU22 will respond reliably to Host Link traffic from any conforming client. If intermittent failures persist after these changes, the bottleneck is almost always the USB-to-serial converter or the COM port enumeration, not the PLC.
Frequently Asked Questions
What is the correct DIP switch setting to use Host Link on the CJ1M peripheral port?
Set DIP switch 4 to ON, leave SW1, SW2, and SW3 OFF, and cycle power. The PLC Setup parameter for the peripheral port must also be set to Host Link, but that change is only honoured when SW4 is ON. Use CX-Programmer to verify the active setting under Settings -> Host Link Port.
What are the default Host Link serial parameters on a CJ1M CPU13 or CPU22?
The factory defaults are 9600 bps, 7 data bits, even parity, 2 stop bits, node number 00, and FCS check enabled. These match the Sysmac Way specification and are the values most third-party HMIs and SCADA drivers expect.
Can I use a generic USB-to-RS232 converter with a CJ1M?
Yes for bench tests, but not recommended for production. CH340 and Prolific PL2303 converters are known to drop characters at the 16-byte Host Link boundary. Use an Omron CS1W-CIF31, an FTDI-based converter, or a PCMCIA / ExpressCard serial card for unattended operation.
Why does the link work only when both serial ports have a cable plugged in?
The PLC does not require two cables. The behaviour is a Windows COM port enumeration artifact: with both cables connected, the application opens the COM number that is actually mapped to the port the PLC answers on. When one cable is unplugged, the COM number re-enumerates and the application opens the wrong port. Lock the COM number in Device Manager and verify the mapping before relying on the link.
Is the peripheral port the same as the RS232 port electrically?
No. The peripheral port uses a mini-DIN connector and the Omron Toolbus signalling by default; the RS232 port uses a DB-9 and is true EIA-232. Use a USB-CN226 cable for the peripheral port or an XW2Z-200S-CV cable for the RS232 port. Substituting a generic mini-DIN cable will not work.