J1939 to S7-300 Integration: Gateway Options and STEP 7 Setup
SAE J1939 is the dominant heavy-duty vehicle and engine control network, but it is physically and logically incompatible with a Siemens S7-300 PLC, which has no native CAN interface and no native J1939 stack. The two practical paths are (a) a third-party CAN module such as the CAN300 with an S7-300 backplane, or (b) a J1939-to-Ethernet gateway that exposes the engine data as Modbus/TCP, Ethernet/IP, ISO-on-TCP (RFC 1006), or PROFINET to a CP343-1 on the S7-300. This reference covers the protocol mechanics, the Siemens CP options, the gateway evaluation matrix, and the STEP 7 configuration required for each path.
1. J1939 Protocol Stack Recap
J1939 is defined by the SAE J1939 family of documents and runs on a CAN 2.0B physical layer (ISO 11898) using the 29-bit identifier frame. It is not CANopen and cannot be parsed with any CANopen library.
| Layer | J1939 Element | Notes |
|---|---|---|
| Physical | CAN 2.0B, 250 kbps typical | Twisted pair, 120 Ω terminated |
| Data Link | 29-bit CAN ID | Priority (3), Reserved (1), Data Page (1), PGN (18), Source Address (8) |
| Network | Address Claiming (PGN 60928) | Each ECU must claim a unique 8-bit address |
| Transport (BAM) | PGN 60416 TP.CM_BAM + 60160 TP.DT | Broadcast, up to 1785 bytes |
| Transport (RTS/CTS) | PGN 60416 TP.CM + 60160 TP.DT | Peer-to-peer, up to 1785 bytes |
| Application | SPNs packed in 8-byte slots | Suspect Parameter Numbers, scaled and offset |
Parameter Group Numbers (PGNs) the engine will normally broadcast on a typical diesel/electric set:
| PGN (Hex) | Name | Acronym | Useful SPNs |
|---|---|---|---|
| 0xF004 | Electronic Engine Controller 1 | EEC1 | SPN 110 Engine Coolant Temp, SPN 100 Engine Speed, SPN 102 Boost Pressure, SPN 91 Throttle Position |
| 0xF003 | Electronic Engine Controller 2 | EEC2 | SPN 91 Accel Pedal, SPN 92 Load % |
| 0xFEEE | Engine Temperature 1 | ET1 | SPN 110 Coolant, SPN 174 Fuel Temp, SPN 175 Oil Temp |
| 0xFEF2 | Fuel Economy (Liquid) | FE | SPN 184 Fuel Rate L/h |
| 0xFEE5 | Engine Hours, Revolutions | HRES | SPN 247 Total Engine Hours |
| 0xFECA | DM1 Active Diagnostic Trouble Codes | DM1 | Lamp Status + DTC list (SPN/CM1/FMI) |
| 0xFECB | DM2 Previously Active DTCs | DM2 | Historical fault codes |
2. Integration Paths Compared
| Approach | Hardware | Engineering Cost | Cycle Time | Best Use Case |
|---|---|---|---|---|
| CAN300 + backplane module | Janitza/SYS TEC CAN300, HMS IXXAT, Peak PCAN in S7-300 slot | High — full J1939 stack in STEP 7 | 10–50 ms | Tightly integrated, deterministic, no extra node |
| J1939 → Modbus/TCP gateway | HMS Anybus X-gateway, Woodhead Brad MappLink, Turck TBEN, Red Lion ICX35 | Low — register-map gateway | 20–100 ms | Most S7-300 retrofits; CP343-1 Lean is sufficient |
| J1939 → Ethernet/IP gateway | HMS Anybus X-gateway, ProSoft PLX31-J1939, HMS EtherNet/IP Scanner card | Medium — CIP assemblies | 10–30 ms | Sites already on EtherNet/IP; CP343-1 PN required |
| J1939 → PROFINET gateway | Softing echolink S7, Inatech, Helmholz PN/CAN | Medium — slot-based I/O mapping | 10–30 ms | Native PROFINET integration, full TIA Portal / STEP 7 support |
| J1939 → ISO-on-TCP (raw) | Custom PC bridge (WinAC, IPC + Python/CANlib) | High — custom stack on PC | 50–200 ms | When no industrial gateway is acceptable and a PC is on the network |
For most S7-300 sites the lowest-risk path is the J1939 → Modbus/TCP gateway because every CP343-1 supports Modbus/TCP as a server/client without additional hardware, and the S7 side reduces to a standard FB65/FB66 program block sequence.
3. Siemens Hardware Required on the S7-300 Side
| Module | MLFB (6GK7-) | Protocols Supported | Notes |
|---|---|---|---|
| CP343-1 Lean | 343-1CX10-0XE0 | TCP/IP, UDP, ISO-on-TCP (RFC 1006), Modbus/TCP via FB65/66 | 1 port, 100 Mbps, 8 connections, sufficient for one gateway |
| CP343-1 | 343-1EX30-0XE0 | Adds PROFINET IO Controller/Device, supports Modbus/TCP | 2 ports (switched), 32 connections |
| CP343-1 Advanced | 343-1GX30-0XE0 | Adds IT functions (FTP, HTTP, e-mail, SNMP), Modbus/TCP, ISO-on-TCP | Used when gateway data must be logged/forwarded to ERP |
| CP343-1 PN (Ethernet/IP variant) | 343-1HX00-0XE0 with Ethernet/IP add-on | EtherNet/IP Scanner/Adapter (from FW V3.0) | Limited CIP connection count (~8) |
| WinAC RTX (PC) | WinAC RTX 2010 / 2013 | Any Windows-side stack (CAN, J1939 DLL, Modbus/TCP, OPC) | For sites that want a custom C++/C# J1939 stack in the controller |
Refer to the Siemens CP343-1 Lean manual (entry ID 24409951) and the CP343-1 Advanced manual (entry ID 24408373) for the firmwared, connection-count, and protocol limits relevant to your firmware version.
4. Selecting a J1939-to-Ethernet Gateway
Selection criteria for an industrial J1939 gateway that will live on the plant floor next to a S7-300 panel:
- J1939 stack maturity. Confirm hardware support for Address Claiming (PGN 60928), Request PGN (PGN 59904), and BAM + RTS/CTS transport. Entry-level converters that only handle PGN-broadcast passthrough will silently fail on request-driven PGNs like DM1/DM2.
- SPN scaling. The gateway should expose engineering-unit values (°C, kPa, RPM, L/h), not raw byte values. This is the single biggest field-failure cause.
- Request interval. The gateway must poll PGNs at a configurable rate (typically 100–1000 ms). Some engines only broadcast EEC1 at 100 ms; others require a Request PGN to be sent.
-
Connection model on the Ethernet side.
- Modbus/TCP server: each PGN → a fixed Holding Register range.
- Ethernet/IP: each PGN → an Input Assembly, typically 16–32 bytes.
- PROFINET: each PGN → a slot/sub-slot.
- Diagnostic transparency. DM1 (active DTCs) and DM2 (historic DTCs) must be exposed as register/assembly data, not swallowed.
- Power and environment. Industrial temperature (-40 to +75 °C), 24 VDC, DIN rail, IP20 minimum, UL/CE/ATEX as required.
Reference devices that meet all six points:
| Gateway | Vendor | Output Protocol | Approx. Order Code |
|---|---|---|---|
| Anybus X-gateway J1939 | HMS Networks | Modbus/TCP, EtherNet/IP, PROFINET, EtherCAT variants | AB7648 (EtherNet/IP), AB7647 (PROFINET) |
| ProSoft PLX31-J1939 | ProSoft Technology | EtherNet/IP | PLX31-EIP-J1939 |
| Brad mappLink J1939 | Molex / Woodhead Brad | Modbus/TCP | 112097-5020 |
| ICX35-IJ1939 | Red Lion Controls | Modbus/TCP | ICX35-IJ1939-M |
| TBEN-S1-J1939 | Turck | Modbus/TCP, EtherNet/IP, PROFINET | 6814018 |
| Helmholz PN/CAN J1939 | Helmholz Systeme | PROFINET | 700-179-3MK02 |
5. Configuration Walk-Through — J1939 → Modbus/TCP → CP343-1
5.1 Gateway-side register map
Configure the gateway to expose the requested PGNs as Modbus Holding Registers. Example map produced by a typical J1939-to-Modbus/TCP converter:
| Modbus Address (0-based) | Type | Content | Units | Source PGN |
|---|---|---|---|---|
| 400001 (0) | UInt16 | Engine Speed | rpm | EEC1 SPN 100 |
| 400003 (2) | UInt16 | Coolant Temperature | °C | ET1 SPN 110 |
| 400005 (4) | UInt16 | Oil Pressure | kPa | EFL/P1 SPN 100 |
| 400007 (6) | UInt16 | Fuel Rate | 0.1 L/h | FE SPN 184 |
| 400009 (8) | UInt16 | Throttle Position | % | EEC1 SPN 91 |
| 400011 (10) | UInt16 | Total Engine Hours | h | HRES SPN 247 |
| 400013 (12) | UInt16 | Battery Voltage | 0.1 V | VI SPN 168 |
| 400015 (14) | UInt16 | DM1 Lamp Status | bits | DM1 byte 0 |
| 400016 (15) | UInt16 | DM1 SPN (first) | — | DM1 bytes 1–4 |
| 400017 (16) | UInt16 | DM1 FMI (first) | — | DM1 byte 5 |
5.2 CP343-1 hardware configuration
- Open the SIMATIC Manager project for the S7-300 station.
- In HW Config, drag the CP343-1 Lean (6GK7 343-1CX10-0XE0) into slot 4 (or any free slot).
- Double-click the CP → Properties → Ethernet Interface → assign an IP address on the plant subnet (e.g.
192.168.10.20, subnet mask255.255.255.0). - Switch to the "Connections" tab of the CP properties; create one new TCP connection (not ISO-on-TCP, not UDP) toward the gateway IP, port
502. - Mark the connection active on the S7 side and assign the local port to
2000(any free passive port works; the remote port stays 502). - Compile and download HW Config.
5.3 STEP 7 program blocks
The standard blocks for Modbus/TCP on S7-300 are FB65 "TCON" (open), FB66 "TDISCON" (close), FB63 "TSEND" (send request), FB64 "TRCV" (receive response), and the DB referenced by IDB of TCON. The Modbus read transaction is built as a 12-byte MBAP header + 5-byte function code frame:
// S7-300 SCL — Modbus/TCP Read Holding Registers (Function 03)
// 12 bytes MBAP header + 5 bytes PDU
// Triggered every 200 ms from OB35
FUNCTION_BLOCK FB_J1939_Read
VAR
iTrigger : BOOL; // rising edge starts a transaction
iStartAddr : INT := 0; // Modbus start address (0-based)
iQty : INT := 14; // number of 16-bit holding registers
iTimeout : TIME := T#1S;
xBusy : BOOL;
xError : BOOL;
wError : WORD;
aSend : ARRAY[0..7] OF BYTE; // 8 bytes MBAP+PDU header
aRecv : ARRAY[0..31] OF BYTE;
iData : ARRAY[0..13] OF INT; // 14 register values
END_VAR
// MBAP header (6 bytes):
// Transaction ID = 0001
// Protocol ID = 0000 (Modbus)
// Length = 0006 (bytes following: UID + FC + 2*Qty + 2)
// PDU (5 bytes):
// Unit ID = 01, FC = 03, StartHi, StartLo, QtyHi, QtyLo
IF iTrigger AND NOT xBusy THEN
aSend[0] := 16#00; aSend[1] := 16#01; // Tx ID
aSend[2] := 16#00; aSend[3] := 16#00; // Protocol ID
aSend[4] := 16#00; aSend[5] := 16#06; // Length
aSend[6] := 16#01; // Unit ID
aSend[7] := 16#03; // Function Code 03
// Start address and qty inserted at runtime below
// Note: the actual 12-byte frame above is shown compactly;
// expand to 12 bytes (2-byte Tx ID + 2-byte Proto + 2-byte Len +
// 1-byte UID + 1-byte FC + 2-byte Start + 2-byte Qty).
xBusy := TRUE;
END_IF;
The recommended Siemens approach is to drop FB65 "TCON", FB63 "TSEND", FB64 "TRCV" into OB35 (cyclic interrupt 200 ms), and write the MBAP frame in a separate FB that builds it from the CP's connection ID. Use the Siemens Modbus/TCP example project for CP343-1 (entry ID 24016777) as a working baseline; it ships with a sample S7 program, a connection DB, and an Excel-based address calculator.
5.4 Verification checklist
- Online → CP343-1 → Diagnostics → Connection List: the TCP connection toward the gateway must show state ESTABLISHED with bytes-sent/received incrementing.
- Force
iTrigger := TRUEand watchxBusytoggle toFALSEwithin ~50 ms;xErrormust remain FALSE. - Compare the engine-speed value (aData[0]) to the value shown on the engine HMI panel — they must agree within ±5 rpm.
- Stop the engine and confirm
aData[2](coolant) drops toward ambient within 30 minutes (sanity check on scaling and unit conversion). - Inject a DM1 fault (e.g. disconnect the coolant sensor) and confirm
aData[14](lamp status) goes non-zero within two 200 ms cycles.
6. Configuration Walk-Through — J1939 → PROFINET → CP343-1 PN
When the gateway supports PROFINET, the S7-300 side becomes even simpler because PROFINET IO is directly supported by CP343-1 EX30/GX30.
- In HW Config, assign the CP343-1 EX30 to the PROFINET subnet and configure its PROFINET IO Controller role.
- Install the gateway's GSDML file (e.g.
GSDML-V2.3-HMS-PNJ1939-...) into STEP 7 via Options → Install GSD File. - Drag the gateway from the PROFINET IO directory into the subnet; assign it IP
192.168.10.50and a PROFINET device name (e.g. J1939-CAN-GW). - Map PGNs to slots — each slot becomes one or two words in the I/O image. Typical mapping: slot 1 = EEC1 (4 words), slot 2 = ET1 (2 words), slot 3 = FE (2 words), slot 4 = DM1 (8 words).
- Download HW Config. The gateway's I/O is now updated every PROFINET cycle (1–4 ms).
Use the gateway's web interface to confirm the J1939 side is healthy: bus load < 50 %, error frames < 100/min, claimed address 0x00 (Engine 1).
7. Configuration Walk-Through — J1939 → Ethernet/IP → CP343-1 PN
From CP343-1 firmware V3.0, the CP supports Ethernet/IP as a Scanner (Master) on a limited basis — typically up to 8 CIP connections. This works for small PGN sets. Siemens entry ID 92027198 documents the Ethernet/IP firmware add-on.
- Upgrade the CP343-1 PN firmware to V3.0.x (e.g. 6GK7 343-1HX00-0XE0 FW V3.0.10).
- Enable the Ethernet/IP functionality in HW Config under the CP properties (license required in some FW versions).
- Configure the CP as EtherNet/IP Scanner; enter the gateway IP
192.168.10.50. - Define Input Assembly 0x64 (100) and 0x65 (101) — 16 and 32 bytes respectively, matching the gateway's mapping.
- Use the standard S7-side logic
L PEW / T DBWto pull engine data from the process image.
8. The "WinAC + PC" Path (When No Industrial Gateway Is Acceptable)
A WinAC RTX slot PLC runs the S7 program on a Windows IPC and exchanges process data with any PC-attached CAN hardware via the SIMATIC NET OPC server. This is the only path that gives you direct access to the raw J1939 frames without a converter box.
- Install an IPC with a PEAK PCAN-PCI, IXXAT USB-to-CAN, or Kvaser Leaf interface.
- Install a J1939 stack (e.g. IXXAT J1939 stack, or the Kvaser J1939 library) on Windows.
- Open a J1939 channel, claim an address (Address Claiming 0xFE = Industry Group 2, Arbitrary), and subscribe to PGNs 0xF004, 0xFEEE, 0xFEF2, etc.
- Build a Windows service that scales the SPNs to engineering units and pushes values into the WinAC RTX process image via SIMATIC NET OPC or a memory-mapped file.
- The S7 program reads the values as if they came from local I/O.
This path trades hardware cost and engineering complexity for the highest possible flexibility (you can subscribe to any PGN, run proprietary diagnostics, log DM1 history, etc.). It is the right answer for OEM equipment builders who need J1939 mastery; it is the wrong answer for a one-off retrofit where a $600 gateway would do.
9. SPN Scaling Reference (For DIY Gateway Programming)
If you are writing your own J1939-to-Modbus mapping, use this formula:
// SPN engineering value from raw byte(s)
// byte_offset = position of LSB inside the 8-byte CAN payload
// length = 1, 2, or 4 bytes (J1939 transmission is little-endian)
// resolution = LSB weight
// offset = zero-point offset
EngineeringValue := 0.0;
FOR i := 0 TO length-1 DO
EngineeringValue := EngineeringValue + raw_bytes[byte_offset + i] * (256 ** i);
END_FOR;
EngineeringValue := (EngineeringValue * resolution) + offset;
Examples (from SAE J1939-71):
| SPN | Bytes | Resolution | Offset | Raw | Engineering |
|---|---|---|---|---|---|
| 110 Coolant Temp | 1 | 1 °C | -40 °C | 0x7B | 83 °C |
| 100 Engine Speed | 2 | 0.125 rpm | 0 | 0x1770 | 1500 rpm |
| 184 Fuel Rate | 2 | 0.05 L/h | 0 | 0x0064 | 5.0 L/h |
| 91 Throttle | 1 | 0.4 % | 0 | 0xFA | 100 % |
| 168 Battery Potential | 2 | 0.05 V | 0 | 0x09C4 | 25.0 V |
10. Troubleshooting Matrix
| Symptom | Likely Root Cause | Diagnostic | Fix |
|---|---|---|---|
| CP343-1 connection stays in SYN_SENT | Gateway IP / subnet mismatch, port 502 filtered | Wireshark on plant switch — look for SYN retransmits; ping gateway from PC on the same subnet | Correct IP/subnet, open TCP/502, confirm router does not block |
| Connection ESTABLISHED but all reads return 0 | Unit ID wrong, gateway in wrong Modbus role, or wrong Modbus function | Read gateway register 1 with a Modbus poll tool (e.g. modpoll, CAS Modbus Scanner) from the same PC | Match Unit ID to gateway config; switch gateway to Modbus server |
| Reads return raw 16-bit values that don't match HMI | SPN scaling not applied in gateway | Disable gateway SPN scaling temporarily; compare raw to HMI scaling table | Enable gateway's "engineering units" mode, or apply scaling in S7 FB |
| Engine speed jumps ±200 rpm | PGN 0xF004 not polled often enough | Gateway diagnostic → Request interval | Reduce request interval to ≤ 50 ms, or broadcast mode if engine supports it |
| No data after engine warm-up; works cold | Address Claiming collision — engine and gateway both claimed 0x00
|
Gateway log → "address cannot be claimed" | Reconfigure gateway to claim 0xF0 (arbitrary industry) via J1939 NAME |
| DM1 never populates | Gateway is passive (only listens to broadcasts) and DM1 is Request-only | Gateway diagnostic → PGN 0xFECA on transport list | Enable PGN requester on gateway, target PGN 0xFECA every 1 s |
| DM1 populates with stale codes | Reading DM2 (history) instead of DM1 (active) | Compare first 2 bytes (lamp status) on engine HMI vs gateway | Map correct PGN 0xFECA, not 0xFECB |
| S7 program reads intermittently time out | FB65/FB63 blocking call left in OB1 with long monitor time | OB1 scan time / diagnostic buffer entry "FB65 timeout" | Move FB65/FB63/FB64 calls into OB35, set monitor time to T#500ms, supervise with xError
|
| Coolant reads 0 °C or 255 °C | "Not available" / "Error" J1939 sentinels not stripped | Raw byte == 0xFF or 0xFE | In S7, mask 0xFE/0xFF and replace with last-good-value or 0 |
| Ethernet/IP scanner logs "no CIP connection" | CP343-1 firmware too old for Ethernet/IP | HW Config → CP properties → Ethernet/IP tab missing | Upgrade CP to FW V3.0.x (entry ID 92027198) |
11. Standards and Compliance
- SAE J1939-21 — Data Link Layer (29-bit CAN ID, BAM, RTS/CTS).
- SAE J1939-71 — Vehicle Application Layer (PGN/SPN definitions, scaling).
- SAE J1939-73 — Diagnostics (DM1, DM2, DM14).
- SAE J1939-81 — Network Management / Address Claiming.
- ISO 11898-1/2 — CAN physical layer (250 kbps for J1939).
- IEC 61158 — Fieldbus (PROFINET part referenced by CP343-1 PN).
- RFC 1006 — ISO-on-TCP transport (only for raw byte pipe, not for J1939 parsing).
- Modbus Organization Modbus/TCP — MBAP + Function Code 03/06/16 reference.
12. Recommendation Summary
- Single engine, small retrofit, low budget: J1939 → Modbus/TCP gateway (HMS Anybus, Red Lion ICX35, Turck TBEN) + CP343-1 Lean + FB65/FB63/FB64 in OB35.
- Multi-engine plant or existing PROFINET infrastructure: J1939 → PROFINET gateway (Helmholz PN/CAN, HMS Anybus PROFINET variant) + CP343-1 EX30/GX30 with GSDML.
- Existing EtherNet/IP site (e.g. CompactLogix or S7-1500 mixed fleet): J1939 → Ethernet/IP gateway (ProSoft PLX31, HMS Anybus Ethernet/IP) + CP343-1 PN with Ethernet/IP firmware add-on.
- OEM with deep J1939 customization needs: WinAC RTX + IPC with IXXAT/PEAK/Kvaser CAN + native J1939 stack + SIMATIC NET OPC.
- Avoid: ISO-on-TCP as the J1939 carrier. It is a byte-pipe; you still need a stack at each end. Modbus/TCP gives you a deterministic, polled, register-based view that maps cleanly onto STEP 7's data-block model.
Which Siemens CP supports Modbus/TCP for S7-300?
CP343-1 Lean (6GK7 343-1CX10-0XE0), CP343-1 (6GK7 343-1EX30-0XE0), and CP343-1 Advanced (6GK7 343-1GX30-0XE0) all support Modbus/TCP via FB65 (TCON), FB63 (TSEND), and FB64 (TRCV). The Lean variant is sufficient for one J1939 gateway.
Can I connect J1939 directly to a S7-300 without a gateway?
Only with a third-party CAN module in the S7-300 backplane (e.g. SYS TEC CAN300, HMS IXXAT) plus a custom J1939 stack implemented in STEP 7. There is no Siemens-native CAN or J1939 module for the S7-300 family.
What is the difference between ISO-on-TCP and Modbus/TCP for J1939 data?
ISO-on-TCP (RFC 1006) is a generic reliable byte stream; it does not define any J1939 registers or scaling. Modbus/TCP defines a register-based request/response (FC03 read holding register) that maps cleanly to engine data. For J1939, use Modbus/TCP — ISO-on-TCP forces you to define your own protocol on top.
Which PGNs should I read first for engine monitoring?
EEC1 (0xF004) for engine speed, ET1 (0xFEEE) for coolant/oil/fuel temperatures, FE (0xFEF2) for fuel rate, HRES (0xFEE5) for total engine hours, and DM1 (0xFECA) for active diagnostic trouble codes. Together these five PGNs cover >90% of typical SCADA needs.
Why does my engine speed read 1500 rpm on the HMI but 1500.125 on the PLC?
SAE J1939-71 defines engine speed (SPN 100) with a resolution of 0.125 rpm. If your gateway exposes the raw byte without applying the resolution, the PLC value will appear as a raw 16-bit count. Configure the gateway to apply the 0.125 scaling, or do it in the STEP 7 FB before storing to the data block.