Resolving CM 1241 RS232 Truncation with Zebra LS2208 Scanner

David Krause15 min read
S7-1200SiemensTroubleshooting
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

1. Problem Overview

A common field issue when integrating a Zebra (formerly Motorola/Symbol) LS2208 handheld barcode scanner with a SIMATIC S7-1200 CPU through a CM 1241 RS232 communications module is partial-data reception: the receive DB ends up holding only the trailing three characters of every scan (for example, the barcode 72-71882-01 arrives as -01). The RCV_PTP instruction reports a successful reception, the LED on the CM 1241 flashes once per scan, and Hyperterminal displays the complete string without alteration, which makes the symptom point at the PLC-side interface or cabling rather than the scanner firmware.

The root cause sits in the interaction between the scanner's default handshaking expectation and the cable shipped with the LS2208. The vendor-supplied cable (CBA-R02-C09PAR, an RJ48 to DB9 RS232 coiled cable) wires the full RS232 signal set, including RTS/CTS and DTR/DSR. The CM 1241 RS232 does not actively drive these handshake lines in the same way a PC COM port does, so the scanner either stalls mid-transmission or drops leading characters when it does not see the expected clear-to-send behaviour. The cure is to limit the physical cable to the three-wire minimum (pins 2, 3, and 5 of the DB9) and to match the scanner's Flow Control host parameter to None.

2. CM 1241 RS232 Hardware Characteristics

The CM 1241 RS232 (order number 6ES7241-1AH32-0XB0) is a plug-in communications module that occupies one slot of the S7-1200 CPU. The on-board RS232 transceiver is designed for point-to-point full-duplex serial communication and exposes a female DB9 connector on the front bezel. The relevant electrical and protocol limits per the S7-1200 Manual Collection CM 1241 RS232 specifications are summarised below.

Parameter Value
Order number (MLFB) 6ES7241-1AH32-0XB0
Baud rates supported 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 76800, 115200 bps
Data bits 7 or 8
Parity None, Even, Odd, Mark, Space
Stop bits 1 or 2
Flow control (transceiver) RTS/CTS hardware handshaking supported; XON/XOFF software handshaking not supported by hardware (must be implemented in user program if used)
Receiver input voltage ±30 V DC max (RS232 compliant)
Isolation RS232 signal to chassis ground and RS232 signal to CPU logic common, both 707 V DC
Cable length max 15 m (50 ft) at 115.2 kbps, derate for higher noise environments
Connector DB9 female (DCE-style for the data lines)

Three important behavioural points are implied by the table:

  1. The transceiver is RS232-compliant and tolerates ±30 V on RxD, so a passive cable rewire cannot damage the port.
  2. Hardware handshaking is optional: the port will transmit and receive correctly with no RTS/CTS loopback as long as the connected device does not assert flow control.
  3. Default TIA Portal project configuration sets Flow control = None in the module properties unless the engineer explicitly changes it. This is the configuration that should be paired with a 3-wire scanner cable.

3. Zebra LS2208 Scanner Defaults

The LS2208 is a rugged linear-imaging scanner. Per the Zebra LS2208 Quick Start Guide (MN000753A04EN), the device automatically detects the host interface type by examining the cable and the incoming signal levels. With the RS232 cable fitted, the scanner scans host-interface parameter set Host = RS-232 by default. The default sub-parameters for the RS232 host are:

Parameter LS2208 default for RS232
Baud rate 9600 bps
Parity None
Data bits 8
Stop bits 1
Flow control None
Inter-character delay 0 ms
Transmit terminator CR (0x0D)
Prefix / Suffix None / None
Beep on transmit Enabled

On paper these defaults match the CM 1241 defaults exactly, which is why a field engineer can be misled into thinking the issue is in the PLC program. In practice, the LS2208 still presents its hardware handshake lines on the RJ48 connector, and a passive RS232 cable that wires those lines through to the DB9 can confuse the CM 1241 receiver logic if the scanner momentarily transitions the lines while it is in the middle of transmitting a string.

4. Anatomy of the CBA-R02-C09PAR Cable

The Symbol/Motorola cable referenced in the original field report is the CBA-R02-C09PAR: an RJ48 (10P10C) plug on the scanner side, a coiled 9 ft / 3 m section, and a DB9 female on the host side. The scanner's RJ48 breakout used by this cable family is:

RJ48 pin (10P10C) Signal DB9 pin (DCE)
1 TRS (TTL-level RTS from scanner) 7 (RTS)
2 TCS (TTL-level CTS to scanner) 8 (CTS)
3 TxD (scanner transmit data) 2 (RxD on DCE host)
4 GND 5 (GND)
5 RxD (scanner receive data) 3 (TxD on DCE host)
6 RTN (return / +5 V from host) 9 (RI, sometimes used for 5 V power in some cables)
7-10 Reserved / no connect on LS2208 Not connected

The LS2208 Quick Start Guide notes that pin 6 of the RJ48 carries +5 V from the host when the host supplies it; the LS2208 itself does not draw operating current from this pin, so a passive cable is safe. The relevant data-path signals for ordinary ASCII traffic are RJ48 pins 3, 4, and 5, which the cable routes to DB9 pins 2, 5, and 3 respectively.

Why the cable matters: Even though the scanner is configured for no flow control, the CBA-R02-C09PAR cable still brings the RTS line (RJ48 pin 1, DB9 pin 7) out to the host connector. The CM 1241 RS232 monitors this line for a half-second during port open; if the scanner holds the line in an unexpected state (idle-high on Zebra's TTL-RTS) while the first characters of the barcode arrive, the PLC receiver can interpret the handshake as not ready and discard the leading bytes. The trailing three characters survive because by the time the LS2208 finishes transmitting the prefix, the RTS line has settled and the data path becomes valid.

5. Root Cause: Handshake Line and RCV_PTP Interaction

The truncation of a complete barcode to its trailing three bytes is the signature of one of two underlying mechanisms. Both point at the cable/handshake interaction rather than at the RCV_PTP logic itself.

5.1 Mechanism A — RTS line stalls the scanner

The CBA-R02-C09PAR cable carries the LS2208's RTS output to the CM 1241's CTS input. If the CM 1241 does not assert a valid logic level on its RTS line (pin 7, which the module uses for outgoing hardware flow control), the LS2208 may treat this as CTS not asserted for a brief window after power-up or after each trigger pull, and will simply hold the first N bytes in its internal FIFO until the condition clears. Once the FIFO finally drains, only the last three bytes remain in the PLC's receive DB because the receive length reported by RCV_PTP reflects the bytes available at the time the block is called.

5.2 Mechanism B — CM 1241 input buffer handshake mis-decode

The CM 1241 serial firmware in firmware versions V2.x and earlier had an edge case in which a floating or actively toggling CTS line at the start of a transmission was interpreted as a temporary not-ready state. The receiver discarded bytes until the line stabilised. In firmware V3.0 and later, the buffer controller was tightened, but the same symptom can still be induced by the wrong cable.

Both mechanisms are eliminated by removing the handshake lines from the signal path entirely. The cure is a three-wire RS232 connection.

6. The Three-Wire RS232 Solution

The minimum RS232 connection that supports full-duplex asynchronous communication without any form of flow control is three wires:

  • DB9 pin 2 — RxD (host receive; scanner transmits on RJ48 pin 3)
  • DB9 pin 3 — TxD (host transmit; scanner receives on RJ48 pin 5)
  • DB9 pin 5 — GND (signal ground; scanner ground on RJ48 pin 4)

All other DB9 pins (1, 4, 6, 7, 8, 9) are left unconnected on the host side. With this wiring, the scanner and the PLC can communicate bidirectionally only if both devices are configured for No Flow Control. The LS2208 satisfies this requirement by default. The CM 1241 must be set to None in the module's port configuration in TIA Portal.

7. Building the Custom Cable

The field fix is to build a short adapter that breaks out only the three required conductors from the vendor cable, and to leave all other conductors open. The cleanest way to do this is to prepare a female DB9 pigtail wired to the male DB9 of the CBA-R02-C09PAR cable through a backshell, but it is faster to cut the existing cable at a convenient point and re-terminate.

  1. Strip approximately 30 mm of the outer jacket from the CBA-R02-C09PAR cable at a point about 30 cm from the scanner end. This keeps wear-and-tear on the heavy scanner-side portion intact.
  2. Identify the six conductors that the cable uses (per the table in §4). The cable is unshielded twisted pair, with each signal on a coloured wire; the typical colour map is Red = +5 V/RTN, Black = GND, White = TxD, Green = RxD, Blue = RTS, Yellow = CTS. Verify with a continuity tester against RJ48 pins 1–6 rather than relying on the colour code.
  3. Cut and insulate the Blue (RTS) and Yellow (CTS) conductors with heat-shrink. They are no longer used and any stray contact with the DB9 shell or with each other will re-introduce the truncation.
  4. Crimp or solder a new male DB9 connector onto the remaining four conductors (TxD, RxD, GND, RTN).
  5. Map the conductors to DB9 pins as follows: White → pin 2, Green → pin 3, Black → pin 5, Red → leave unconnected (or optionally to pin 9, which is a no-op on the CM 1241 RS232).
  6. Apply a 360° cable clamp to the backshell so the jacket carries any pulling force.

Continuity-test the finished cable end-to-end with a multimeter. Expected resistance from RJ48 pin to DB9 pin should be below 1 Ω on each of the three active pairs, and infinite on pins 1, 4, 6, 7, 8, and 9 at the DB9.

8. TIA Portal Module Configuration

Open the device configuration of the S7-1200 in TIA Portal and select the CM 1241 RS232 in the slot. In the inspector window under Properties > Port configuration, set:

Parameter Setting for LS2208
Protocol selection Freeport (Point-to-Point)
Baud rate 9600 bps
Parity None
Data bits 8
Stop bits 1
Flow control None
End-of-receive criteria (idle line) 40 ms (covers 11 characters at 9600 bps with margin)
Enable break detection Optional; leave off for ASCII scanner data
Receive buffer (FIFO) Leave at default 256 bytes unless the application requires more

The End of message criteria tell the CM 1241 when the current string is complete and the RCV_PTP block can be released. The LS2208 appends a CR (0x0D) to every scan, so the more reliable trigger is the Character end criterion set to 0x0D. Using the idle-line criterion at 40 ms is acceptable but a single dropped byte in the transmission may push the last two characters past the timeout window and split one barcode into two receive events.

9. RCV_PTP Block Programming

The receive block is a multi-instance DB or a stand-alone FB of type RCV_PTP from the Communication > Point-to-Point palette. The typical signature in a SCL implementation is:


// FB "LS2208_RCV" — receive barcode from CM 1241 RS232
#RCV_PTP_Instance(REQ     := bTrigger,
                  PORT    := 3,                  // CM 1241 hardware identifier
                  BUFFER  := P#DB_Recv.DBX0.0 BYTE 256,
                  LENGTH  := 0,                  // output
                  DONE    => bDone,
                  ERROR   => bError,
                  STATUS  => wStatus);

Notes for stable operation:

  • Call RCV_PTP once per scan event. The simplest way to detect a scan is to wire its execution to a cyclic OB1 call with a debounced trigger, or to a hardware input from the LS2208's trigger signal if your scanner variant supports it.
  • Allocate the receive buffer as a plain Array of Byte in a global DB. The BUFFER parameter expects a pointer; a 256-byte array comfortably holds the longest Code 39 barcode plus terminators.
  • Do not read LENGTH until DONE is set; reading the output before completion can return a partial value that does not reflect the actual number of bytes received.
  • Clear the buffer to 0x00 at the start of each reception by writing zeros to the array slice from index 0 to LENGTH-1. This prevents the previous barcode's tail from being interpreted as part of the current one when the new barcode is shorter than the previous one.

STATUS error codes that matter most in this scenario:

STATUS (hex) Meaning Action
0x0000 Reception complete, no error Process LENGTH bytes in BUFFER
0x7000 RCV_PTP not yet started No action; check the REQ edge
0x8080 Module not initialised Re-compile hardware and re-download
0x80C0 Parity error on incoming data Verify parity on both ends; check cable shielding
0x80C1 Framing error Verify stop bits and baud rate; check for RS232 level violation
0x80C3 Break condition detected Disable break detection in port configuration if spurious
0x80D0 FIFO overflow Increase poll rate or reduce end-of-message delay

10. Receive Buffer Sizing and Sizing Math

At 9600 bps, 8N1, each character occupies 10 bit-times (start + 8 data + 1 stop). The number of characters received per second is:


char_per_sec = 9600 / 10 = 960 characters/second

A typical LS2208 scan in Code 39 produces 5 to 18 characters plus a CR terminator. Even a worst-case 32-character Code 128 barcode completes in:


t_msg = 32 * (1 / 960) = 33.3 ms

The CM 1241 FIFO is 256 bytes by default and is wide enough for any practical barcode string. Field engineers do not need to enlarge it unless they are queuing multiple scans before the PLC reads them out, in which case the RCV_PTP call rate must be faster than the worst-case inter-scan delay divided by the message length.

11. Verification and Commissioning

After building the custom cable and loading the project, run a structured commissioning sequence.

  1. Power the S7-1200 and the LS2208 from the same 24 V supply to share ground reference.
  2. Open TIA Portal in Online & Diagnostics mode on the CM 1241. Confirm that the module's status field shows OK and that the configured port parameters are reported back (9600, 8, None, 1).
  3. Place the CPU in RUN with a watch table open on the receive DB. Set a breakpoint on the RCV_PTP DONE output.
  4. Scan a 12-character barcode. Verify that LENGTH returns a value greater than or equal to the barcode length plus 1 (for the CR terminator). For 72-71882-01, expect LENGTH = 12 and the buffer to contain the bytes 0x37 0x32 0x2D 0x37 0x31 0x38 0x38 0x32 0x2D 0x30 0x31 0x0D.
  5. Scan a second barcode of a different length. Confirm that no bytes from the previous scan remain in the buffer (the trailing 0x00s after the new LENGTH should be present).
  6. Run a sustained test of 50 scans of mixed-length codes. Confirm that the DONE counter increments by 50 and that ERROR remains false on all 50 events.
  7. If a STATUS of 0x80C1 (framing error) appears, re-check the cable for swapped Tx/Rx and verify the scanner host parameters with a test against Hyperterminal or a serial analyser.

12. Troubleshooting Matrix

Symptom Likely cause Action
Only last 3 bytes arrive in DB Handshake line floating on RTS/CTS, scanner holds FIFO Use 3-wire cable, set flow control to None on both ends
No bytes arrive, RCV_PTP never sets DONE Tx/Rx swapped, no GND, or wrong port identifier Verify cable pinout against §7, confirm PORT parameter matches hardware ID
Garbled characters, framing errors Baud rate or parity mismatch Match scanner to CM 1241: 9600, 8, N, 1 by default
Done sets but LENGTH is always 1 End-of-message criterion never satisfied Set end criterion to 0x0D (CR) or reduce idle-line timeout to 5–10 ms
STATUS 0x80D0 on every scan FIFO overflow because RCV_PTP called too slowly Increase call rate, or move reception to a hardware interrupt OB (e.g., OB40) tied to a digital input wired to the scanner trigger
First scan works, subsequent scans truncated Receive DB not zeroed between scans Zero the BUFFER array at the top of each RCV_PTP call
Intermittent truncation on long cables Capacitive loading of RS232 signal exceeds 2500 pF Shorten cable to < 15 m, use shielded twisted pair, terminate shield to ground at one end only
STATUS 0x80C0 parity error Scanner configured for odd parity, PLC for none (or vice versa) Scan Zebra programming barcode Parity = None from the Product Reference Guide

What is the default baud rate of the LS2208 over RS232?

The LS2208 default RS232 settings are 9600 bps, 8 data bits, no parity, 1 stop bit, no flow control, with a CR (0x0D) terminator appended to every scan. These match the CM 1241 RS232 defaults, so no scanner reprogramming is required for the field fix.

Why does Hyperterminal receive the full barcode but the CM 1241 only sees three characters?

Hyperterminal is a passive terminal emulator; it accepts every byte the scanner transmits and ignores all handshake lines. The CM 1241 monitors the RTS/CTS lines on the DB9 connector and, when the vendor CBA-R02-C09PAR cable brings the scanner's RTS line through, the PLC may stall the receiver until the line stabilises, dropping all but the trailing characters. The 3-wire cable fix removes the handshake lines from the path entirely.

Do I need to change the LS2208's flow control setting when I switch to the 3-wire cable?

No additional change is required. The LS2208 default is None for flow control on the RS232 host, and a 3-wire cable cannot carry handshaking signals regardless of how the scanner is configured. If a previous site has scanned a programming barcode to set flow control to RTS/CTS, you must scan the Flow Control = None barcode from the Zebra LS2208 Product Reference Guide to revert.

What is the difference between the CM 1241 RS232 (6ES7241-1AH32-0XB0) and the RS485 variant (6ES7241-1CH32-0XB0) for scanner use?

The RS232 module (1AH32) is the correct choice for the LS2208 because the scanner's CBA-R02-C09PAR cable terminates in a DB9 with true RS232 levels (±12 V nominal). The RS485 variant (1CH32) uses differential signalling and would require a separate RS485 scanner interface module on the LS2208 (CBA-R04-09PAR or similar) plus a different cable.

Can I use XON/XOFF software flow control instead of rebuilding the cable?

No. The CM 1241 RS232 does not support XON/XOFF in hardware; if you require it, the software handshaking must be implemented in the user program by watching for 0x13 and 0x11 in the receive stream and gating the transmit enable. For barcode-scanner integrations the standard recommendation is to disable flow control at both ends and use the 3-wire cable, which is what the field fix accomplishes.

How long can the RS232 cable be between the LS2208 and the CM 1241?

The RS232 standard (EIA/TIA-232-F) limits cable length to 15 m at up to 20 kbps. At 9600 bps, the practical limit is 15 m, but field installations should derate to 10 m or less in electrically noisy industrial cabinets to stay clear of the 2500 pF maximum load capacitance budget. Coiled cables such as the CBA-R02-C09PAR add roughly 50 pF per metre of unstretched length.

Back to blog