Configuring S7-300 to S7-400 BSEND BRCV Communication in Mixed TIA/STEP 7 Projects
Mixed-vintage SIMATIC fleets are routine in process plants: a new S7-400 CPU is added for a high-availability section, while existing S7-300 stations continue to run on STEP 7 V5.4 because the legacy project is not migrated to TIA Portal. Exchanging process data (often 2 KB or more per scan) between the two generations across Industrial Ethernet requires the BSEND / BRCV pair from the S7 Communication suite. This reference covers the full configuration path, the unspecified S7 connection required for cross-project links, and the well-documented PLCSIM behaviour that blocks FB12 on a simulated S7-300 station.
1. Overview of the Mixed-Environment Problem
S7 Communication provides three transport services that are common in automation networks: PUT/GET for short client-server reads, USEND/URCV for unacknowledged segments, and BSEND/BRCV for fully acknowledged streaming of large buffers. The third pair is implemented as a client-client protocol: both stations hold a configured connection entry, and either side may initiate a transfer. Because the connection is symmetric, both projects must reference the same connection ID and connection description.
When the S7-300 and S7-400 stations live in different STEP 7 projects (typical during migration or brownfield expansion), the connection cannot be created as a specified partner. The S7-400 must instead establish an unspecified S7 connection that references only the IP address, rack, slot, and TSAP of the remote CPU. The S7-300 side holds the matching entry configured as an S7 connection with a fully specified partner.
For ~2 KB payloads, BSEND/BRCV transfers the buffer in a single call rather than fragmenting it across multiple PUT/GET transactions. This eliminates CPU load spikes and simplifies error handling because a single DONE/RERROR handshake confirms the whole transfer.
2. Prerequisites
| Item | Requirement |
|---|---|
| S7-400 CPU | 41x or 41xH with integrated PROFINET/IE interface (e.g. CPU 414-3 PN/DP, CPU 416-3 PN/DP). Firmware V6.0 or later for full TIA Portal V16+ feature support. |
| S7-300 CPU | 31x with PROFINET/IE interface (e.g. CPU 315-2 PN/DP, CPU 317-2 PN/DP) or separate CP343-1. Firmware V3.3 or later recommended. |
| Programming software | STEP 7 V5.4 + SP5 (or later V5.x) for S7-300, TIA Portal V13 SP1 / V14 / V15 / V16 / V17 for S7-400. |
| Network | Industrial Ethernet switched network with sufficient S7 connection resources on both CPUs. Avoid direct crossover; use managed switches (SCALANCE XC/XB/XR). |
| PLCSIM (optional) | PLCSIM V13+ (matches TIA Portal version) for S7-400 simulation; PLCSIM V5.4 + SP5 for S7-300 simulation. Note the FBs vs SFBs restriction documented in §8. |
| Connection resources | S7-300 CPU supports up to 16 S7 connections (CPU 315/317 variants). S7-400 supports 16 to 48 depending on CPU type. Reserve one connection per BSEND/BRCV pair plus one per partner for diagnostics. |
3. BSEND/BRCV Communication Fundamentals
The BSEND instruction ships data to a remote partner instruction of type BRCV. Unlike PUT/GET, which transfer up to 160 user-data bytes per call, BSEND/BRCV can stream up to 65,534 bytes in a single call. The transfer is acknowledged end-to-end: the sender sets DONE=1 only after the receiver confirms the complete payload has been written into the receive area.
3.1 Block Identification Across Environments
The block name changes between STEP 7 V5.x and TIA Portal. The functionality is identical.
| Function | STEP 7 V5.x (S7-300 / S7-400) | TIA Portal (S7-300 / S7-400) |
|---|---|---|
| Send (BSEND) | SFB12 (system function block, integrated in CPU firmware) | FB12 (located in the "Communication" folder under Instructions → Communication → S7 Communication) |
| Receive (BRCV) | SFB13 (system function block, integrated in CPU firmware) | FB13 (located alongside FB12) |
| Instance DB | Auto-generated by STEP 7 when SFB is dropped into a block | Auto-generated when FB is dropped; or manually created as a single-instance DB |
3.2 Interface Definition
| Input / Output | Type | Description |
|---|---|---|
| REQ | BOOL | Rising edge starts a send operation. |
| R | BOOL | Resets the instance and aborts an active transfer. |
| ID | WORD | Local connection ID from the NetPro / connection configuration. Must match both ends. |
| R_ID | DWORD | Application-level identifier; same value required on both sides of the connection. |
| SD_i | VARIANT (TIA) / ANY (V5.x) | Pointer to send area. Must be a full DB or absolute area; do not use optimised access on TIA Portal FBs without selecting standard access compatible area. |
| LEN | INT | Length of data to send in bytes. Max 65,534. |
| DONE | BOOL | Set for one cycle after a successful transfer. |
| ERROR | BOOL | Set for one cycle if an error occurs. |
| STATUS | WORD | Detailed status / error code (see §11). |
| RD_i | VARIANT (TIA) / ANY (V5.x) | Pointer to receive area on the BRCV side. |
| NDR | BOOL | "New data received" - one-cycle pulse on BRCV when data accepted. |
4. Network Architecture
The mixed fleet connects to a single Industrial Ethernet subnet. The diagram below shows the canonical topology used in brownfield S7-300/S7-400 migrations.
Each S7-300 station sends a dedicated payload (e.g. recipe parameters, diagnostic buffers, alarm history) to the S7-400. A separate logical BSEND/BRCV pair is required per data channel, but all pairs can share a single physical S7 connection by using unique R_ID values per pair.
5. Configuring the Unspecified S7 Connection on the S7-400 Side
When the S7-400 project does not contain the S7-300 station as a partner, the TIA Portal offers only an unspecified S7 connection. This connection requires explicit identification of the partner:
- In the TIA Portal project tree, expand Devices & Networks, then select the S7-400 CPU.
- Open Properties → Communication → S7 connections.
- Add a new connection. The partner type is offered as "Unspecified" because no S7-300 CPU is in the project.
- Configure the partner address:
- Interface: PROFINET / Industrial Ethernet
- IP address: 192.168.0.21 (S7-300 #1)
-
Connection resource / TSAP (rack, slot): Rack 0, Slot 2. The TSAP for S7-300 PN CPUs is constructed as
01.0r.sswhereris the rack number (hex) andssis the slot number (hex). For rack 0 / slot 2 the local TSAP is01.00.02.
- Set the Connection ID to
1. This value must be passed to theIDinput of the BRCV FB call. - Set the Active connection establishment flag on the S7-400 side (S7-400 initiates the connection; S7-300 side is passive).
For each additional S7-300 station, repeat the procedure with a unique Connection ID (2, 3, 4, ...). The S7-400 reserves a connection resource for each entry.
01.00.02 corresponds to rack 0 / slot 2; 02.00.02 is rack 0 / slot 2 of a CP343-1 inserted in slot 4 (rack 0 always, with CP slot index being the local slot). Always verify by reading the online Connection table in NetPro / TIA Portal before downloading.6. Configuring the S7 Connection on the S7-300 Side (STEP 7 V5.4)
- Open the STEP 7 V5.4 project that contains the S7-300 station.
- Launch NetPro (Options → Configure Network).
- Select the S7-300 CPU and insert a new S7 connection.
- Choose S7 connection as the connection type, and select the S7-400 partner from the partner list (the S7-400 must be added as a "Other Station" or "S7-400 Station" with its IP address).
- Confirm the Connection ID matches the value used on the S7-400 side (in this case
1). - Configure the local TSAP:
01.00.02for rack 0 / slot 2. - Set the partner IP address to
192.168.0.10and the partner TSAP to01.00.03(S7-400 rack 0 / slot 3). - Leave the connection as passive (the S7-400 is the active end).
Compile and download the NetPro changes. Verify the connection appears as "established" in the CPU's online connection diagnostics.
7. Programming the S7-400 BRCV in TIA Portal
The S7-400 receives data using FB13 (BRCV). The instance DB and connection ID come from the connection configuration described in §5.
// OB1 cyclic main (TIA Portal, S7-400)
// Each cycle: trigger BSEND on the S7-300, then call BRCV on the S7-400
// --- Receive block on S7-400 (BRCV) ---
"BRCV_DB".EN_R := TRUE; // permanently enable reception
"BRCV_DB".ID := W#16#1; // connection ID = 1 (from connection config)
"BRCV_DB".R_ID := DW#16#1000_0001; // application-level ID, must match sender
"BRCV_DB".RD_i := P#DB100.DBX0.0 BYTE 2048; // receive buffer (2 KB), aligned
CALL FB13 "BRCV" , "BRCV_DB";
IF "BRCV_DB".NDR THEN
// new data accepted, copy from DB100 to process area
// (example: copy into DB200 for OPC UA / HMI use)
END_IF;
IF "BRCV_DB".ERROR THEN
// capture STATUS, log to diagnostic buffer, raise alarm
// STATUS format: 8xFx = error class, see §11
END_IF;
VARIANT pointers. Ensure the receive DB has standard access enabled (not optimised) or that the variant pointer is constructed as a symbolic tag rather than a P# area. Mixing optimised DB access with absolute P# pointers causes compile warnings and runtime STATUS 0x24 on some firmware versions.8. Programming the S7-300 BSEND in STEP 7 V5.4
On the S7-300 sender, drop SFB12 (BSEND) from the Standard Library → System Function Blocks folder. STEP 7 V5.4 auto-generates an instance DB; rename it to DB12.
// OB35 (cyclic interrupt, 100 ms) on S7-300 (STEP 7 V5.4)
// Calls SFB12 BSEND to send 2048 bytes from DB50 to the S7-400 receiver
// Pulse REQ every cycle to keep the transfer primed
// (BSEND is acknowledged; once DONE it waits for the next REQ edge)
CALL SFB12 , DB12 (
REQ := M10.0, // rising edge to start each transfer
R := FALSE,
ID := W#16#1, // connection ID 1 (matches NetPro)
R_ID := DW#16#1000_0001, // same application ID as receiver
SD_1 := P#DB50.DBX0.0 BYTE 2048,
LEN := 2048,
DONE := M10.1,
ERROR := M10.2,
STATUS:= MW12
);
For periodic transfer, drive REQ from a timer or process event. To avoid re-triggering on every cycle (which would re-send continuously after DONE), use a one-shot pattern such as a positive-edge evaluation of a 1-Hz clock or a process condition (e.g. data-ready flag from the application).
9. PLCSIM Simulation: Why BSEND Fails Between S7-400 and S7-300
A widely reported behaviour in mixed-fleet simulation is that BSEND/BRCV functions correctly between two S7-400 PLCSIM instances but fails when one end is an S7-300 PLCSIM. The root cause is the block type loaded into the simulated CPU.
9.1 Root Cause
- PLCSIM instances a CPU image, not the full firmware. For S7-300 PLCSIM, the simulated environment expects the SFB variant of the communication block (SFB12 / SFB13), because that is what is stored in the S7-300 CPU operating system.
- If the S7-300 station was programmed in TIA Portal and downloaded as
FB12/FB13, PLCSIM may either fail to instantiate the block correctly or load it but produce inconsistent connection-state behaviour with the partner PLCSIM. The result is a connection error (typically STATUS0x8081or0x8183) on the S7-400 side and a corresponding error on the S7-300 side.
9.2 Resolution
Use the following block-type selection rule when simulating with PLCSIM:
| Scenario | S7-300 sender block | S7-400 receiver block |
|---|---|---|
| Real hardware, real hardware | SFB12 (V5.x) or FB12 (TIA) — both are accepted by the real S7-300 CPU firmware | FB13 (TIA) or SFB13 (V5.x) — accepted by the real S7-400 CPU firmware |
| PLCSIM simulating S7-300, PLCSIM simulating S7-400 | SFB12 must be used on the S7-300 side. FB12 will not establish the simulated connection reliably. | FB13 (TIA) is preferred; the S7-400 PLCSIM accepts TIA-compiled FBs correctly. |
| PLCSIM (S7-400) ↔ real hardware (S7-300) | SFB12 (on real S7-300) — correct for production | FB13 (on PLCSIM S7-400) |
| Real hardware (S7-400) ↔ PLCSIM (S7-300) | SFB12 must be used on PLCSIM; FB12 will not function correctly | FB13 (on real S7-400) |
The engineering implication is that a single TIA Portal project with FB12 on the S7-300 cannot be downloaded to PLCSIM for end-to-end testing without source modifications. The recommended workflow is:
- Maintain the production project with FB12/FB13 in TIA Portal.
- For PLCSIM validation, open the S7-300 station in STEP 7 V5.4 separately, replace the FBs with SFB12/SFB13, and run the simulation from a parallel V5.4 project that mirrors the production connection configuration.
- Once PLCSIM validation passes, load the production TIA Portal project to the real hardware for factory acceptance testing.
10. Block Selection Decision Flowchart
11. Data Size Limits and Buffer Sizing for 2 KB Payloads
BSEND/BRCV accepts up to 65,534 bytes per call. For the 2 KB (~2048 byte) payload described in the source scenario, the limits are well within bounds, but buffer setup must respect these constraints:
- The receive DB must be at least as large as
LEN. Under-sizing causes STATUS0x8085on the receiver. - The send DB area must be byte-aligned. Mixing BOOL, INT, and REAL tags into the same buffer requires careful offset planning because BSEND treats the area as a flat byte stream.
- For data integrity, place the receive DB in the work memory (DB number < 256 on S7-300 if using non-optimised access) to guarantee contiguous storage without paging delays.
| Parameter | Value | Notes |
|---|---|---|
| Max payload per BSEND call | 65,534 bytes | Driven by the underlying TPDU size on S7 communication |
| Typical payload for 2 KB use case | 2,048 bytes | Recommended DB size: 2,160 bytes (round up for alignment) |
| Cycle time for full transfer | ~50–200 ms typical | Depends on network load, switch latency, and CPU scan time |
| Recommended OB for BSEND call | OB35 (cyclic interrupt) or OB1 | Cyclic interrupt decouples transfer from main scan |
| Connection resource overhead | 1 S7 connection per pair | Plan capacity on S7-300 (16 max) and S7-400 (16–48 max) |
12. Status and Error Code Reference
The STATUS output of BSEND/BRCV returns a 16-bit value combining a class byte and a detail byte. The most common codes observed during mixed S7-300/S7-400 commissioning are:
| STATUS | Meaning | Remedy |
|---|---|---|
| 0x0000 | No error, operation in progress or completed cleanly | — |
| 0x7000 | No job active (BSEND) | Check REQ trigger |
| 0x7001 | Job accepted, waiting for acknowledgment | Normal mid-transfer state |
| 0x7002 | Data being sent | Normal mid-transfer state |
| 0x8081 | Connection aborted by partner or remote CPU in STOP | Verify partner CPU is in RUN, rack/slot correct, cable healthy |
| 0x8083 | Connection resource exhausted on local CPU | Reduce number of S7 connections or upgrade CPU type |
| 0x8085 | Receive area too small | Increase RD_i buffer size to ≥ LEN |
| 0x8183 | Connection configuration mismatch (ID, TSAP, R_ID) | Recompile and download connection configuration on both ends |
| 0x80A3 | Connection being established (transient) | Wait one cycle; do not retrigger REQ |
| 0x80B1 | Indirect addressing error on SD_i / RD_i | Check pointer consistency; for TIA Portal, verify DB is non-optimised if using P# pointer |
| 0x80C3 | R_ID mismatch between sender and receiver | Ensure identical R_ID value on both stations |
| 0x80D0 | Block version conflict (firmware) | CPU firmware older than block version; update firmware or use older block |
13. Verification Procedure
Use the following checklist after commissioning:
- Online connection status: On the S7-400, open "Online & Diagnostics → Connection table" and confirm the connection is "Established." Repeat on the S7-300 in NetPro / "Accessible Nodes."
- First transfer test: Force a BSEND call from the S7-300 with a known pattern (e.g. fill DB50 with incrementing bytes 0x00, 0x01, 0x02, ...). On the S7-400, monitor the receive DB in a watch table and verify the pattern arrives.
-
STATUS monitoring: Add STATUS, DONE, ERROR to a watch table on both stations. Confirm
STATUS = W#16#0000or transient values0x7000 / 0x7001 / 0x7002during normal operation. - Stop/Run resilience: Place the S7-300 in STOP for 5 seconds, then return to RUN. Verify the connection re-establishes automatically (S7 communication auto-reconnects on partner return-to-RUN).
- Diagnostic buffer: Read the S7-400 diagnostic buffer ("Online & Diagnostics → Diagnostic buffer") and confirm no permanent S7 communication errors.
- Cycle timing: Measure the OB1 / OB35 scan time before and after the BSEND call to ensure the transfer does not exceed the configured cycle time. Typical 2 KB transfers add 30–60 ms per call on a CPU 315-2 PN/DP.
14. Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic Step | Resolution |
|---|---|---|---|
| Connection does not establish; STATUS 0x8183 | TSAP mismatch (rack/slot error) | Compare partner TSAP in connection table on both ends | Correct TSAP; recompile NetPro / connection config |
| BSEND done but BRCV never fires NDR | R_ID mismatch | Watch both DB instances for R_ID value | Set identical R_ID on both stations |
| STATUS 0x8085 on BRCV | Receive DB too small | Inspect DB size in project; compare to LEN value | Enlarge RD_i buffer to ≥ LEN |
| Connection establishes but data is zero-filled | Source DB pointer is to wrong area / wrong DB number | Watch SD_i pointer; verify DB number | Correct pointer to match source data area |
| BSEND works between two S7-400 PLCSIM but not between S7-400 and S7-300 PLCSIM | SFB/FB block type mismatch on the S7-300 simulator | Open S7-300 PLCSIM station and check whether block is SFB12 or FB12 | Replace FB12 with SFB12 in the S7-300 simulation project |
| STATUS 0x80B1 on first call after CPU restart | Instance DB not initialised on cold restart | Check OB100 / initialisation OB; verify instance DB is reset | Add initialisation call to OB100 or use restart initialisation in CPU properties |
| Connection drops after several hours | Keep-alive timeout exceeded; partner CPU in STOP | Check diagnostic buffer on both ends for S7 connection abort events | Verify partner CPU mode, network switch port configuration, and any firewall / NAT |
| BSEND triggers but transfer is incomplete (LEN truncated) | SD_i source area smaller than LEN value | Verify source DB length ≥ LEN | Adjust LEN to actual source area size |
15. Field-Proven Engineering Notes
- R_ID uniqueness: Each BSEND/BRCV pair uses a unique 32-bit R_ID. Multiple pairs can share the same physical S7 connection as long as R_IDs are distinct. Keep a project-level R_ID registry to avoid collisions during later expansions.
- Network redundancy: For S7-400H redundant systems, configure two separate S7 connections (one per subnet). Use different R_IDs per subnet to avoid the active connection shadowing the standby.
- Firewall / NAT traversal: S7 communication uses TSAP-based addressing and does not traverse IP-NAT cleanly. Place both CPUs on the same Layer-2 subnet, or use SCALANCE security modules with explicit S7-connection rules.
- STEP 7 V5.4 + TIA Portal coexistence: STEP 7 V5.4 and TIA Portal projects can coexist on the same engineering workstation but cannot be open simultaneously against the same CPU. Close one before connecting to the other for online operations.
-
Firmware consistency: For mixed firmware levels (e.g. S7-400 V5.x with S7-300 V3.x), BSEND/BRCV is supported but STATUS
0x80D0may appear if block version exceeds CPU firmware version. Use the block version compatible with the older CPU. - Memory layout: On S7-300 CPUs with limited work memory (e.g. CPU 312), declare receive DBs above DB 200 (data area) rather than below to avoid overlap with the instance DBs of integrated blocks.
16. References for Further Verification
- Siemens Support: S7 Communication between SIMATIC S7-1500 and SIMATIC S7-300 (PDF) — covers the same client-client principle applied to S7-1500 ↔ S7-300, useful for confirming TSAP and connection configuration patterns.
- Siemens TIA Portal Help: BSEND - Send data in segments (S7-300, S7-400) — official instruction reference for FB12 interface, error codes, and programming example.
Frequently Asked Questions
What is the difference between FB12 and SFB12 for BSEND?
FB12 is the TIA Portal user-library block; SFB12 is the system function block integrated into the S7-300/S7-400 CPU firmware and used from STEP 7 V5.x. Functionally identical at runtime on real hardware, but PLCSIM for S7-300 requires SFB12. Use SFB12 on S7-300 for PLCSIM and FB12 on S7-400 in TIA Portal.
Why does BSEND work between two S7-400 PLCSIM instances but fail between S7-400 and S7-300 PLCSIM?
The S7-300 PLCSIM image expects the SFB12 system block from STEP 7 V5.x. If the S7-300 station was downloaded with FB12 (TIA Portal variant), the simulator does not establish the connection reliably. Replace FB12 with SFB12 on the S7-300 simulation side; the real hardware accepts either block.
Can BSEND/BRCV be used across different STEP 7 and TIA Portal projects?
Yes. The S7-400 station configured in TIA Portal uses an unspecified S7 connection (partner IP + TSAP only), and the S7-300 station configured in STEP 7 V5.4 NetPro uses a specified connection referencing the S7-400. Connection ID and R_ID must match on both sides. The mixed programming environment is supported at runtime.
What is the maximum data size per BSEND call?
Up to 65,534 bytes per call. For the typical 2 KB recipe/diagnostic payload, a single BSEND/BRCV pair handles the entire transfer with one acknowledged handshake. Larger buffers still fit within one call but require receiver RD_i buffer ≥ LEN.
How many S7 connections can an S7-300 CPU support?
Standard S7-300 CPUs (CPU 315-2 PN/DP, CPU 317-2 PN/DP) support up to 16 S7 communication connections each for BSEND/BRCV, PUT/GET, and ISO-on-TCP combined. Reserve one connection per BSEND/BRCV pair; a station with 4 S7-300 partners consumes 4 connections on the S7-400 side and 1 each on the S7-300 senders.
How do I configure the TSAP for a rack 0 / slot 2 S7-300 CPU?
For S7-300 PN CPUs, the local TSAP is 01.00.02 (rack 0, slot 2, in the format 01.0r.ss). The remote TSAP for an S7-400 in rack 0 / slot 3 is 01.00.03. Use these values in the connection properties on both ends and verify in the online connection table.
What STATUS code indicates the receive buffer is too small?
STATUS 0x8085 on the BRCV instance. Increase the RD_i destination DB size to at least the LEN value specified by the sender, recompile, and re-download the program.