Configuring AS-to-AS Cross-Controller Communication via NetPro S7 Connections and BSEND-BRECV

Configuring AS-to-AS Cross-Controller Communication via NetPro S7 Connections and BSEND-BRECV

To configure reliable AS-to-AS communication between two SIMATIC S7-400 controllers in a PCS 7 multiproject using BSEND (SFB 12) and BRECV (SFB 13), engineers must properly configure S7 Connections in NetPro and synchronize communication parameters. In NetPro, an S7 Connection is inserted between the two CPU stations, generating a local connection ID for each controller. On the sending CPU, BSEND must be parameterized with the sending CPU's local NetPro connection ID (ID) and a user-defined relationship identifier (R_ID). On the receiving CPU, BRECV must use its own local NetPro connection ID (ID) and the EXACT SAME R_ID value. Mismatching R_ID values or confusing local NetPro IDs with partner IDs prevents block handshakes and triggers write error alarms.

Table of Contents

Cross-Controller Data Exchange: When to Use BSEND/BRECV vs AS-Wide Links

In SIMATIC PCS 7 multi-controller architectures, sharing process data, interlocks, and permissive states between controllers can be implemented via two primary architectures:

1. AS-Wide Interconnections in CFC (Cyclic / Small Data)

The native PCS 7 mechanism for exchanging individual analog and boolean signals directly between CFC charts residing in different AS controllers. The compiler handles communication automatically in the background.

2. Configured S7 Connections with BSEND / BRECV (Block Data / Events)

When transferring large data blocks (e.g., recipes, complete UDT structures, measurement arrays) up to 64 KB, or when transfers must be event-triggered rather than cyclic, engineers use system function blocks:
* BSEND (SFB 12): Asynchronously transmits a memory area (data block) to a partner station.
* BRECV (SFB 13): Receives the data block and writes it into a designated local data structure.

Configuring this communication requires careful coordination between NetPro connection tables and block call parameters.

NetPro Connection Setup: Local IDs vs Partner IDs

A common engineering trap is confusing the local connection ID with the remote partner's connection ID:

  1. Open NetPro in the multiproject.
  2. Select CPU 1 in the AS 1 rack.
  3. In the connection table, insert a new connection to CPU 2 in AS 2:
    * Connection Type: Select S7 connection (or S7 fault-tolerant connection if redundant).
  4. NetPro generates connection properties:
    * Local ID on AS 1: For example, 16#4 (hexadecimal).
    * Partner ID on AS 2: For example, 16#7 (hexadecimal).
  5. The Golden Rule of S7 Connection IDs:
    * The ID parameter on AS 1's BSEND block must be 16#4 (its own local NetPro ID).
    * The ID parameter on AS 2's BRECV block must be 16#7 (its own local NetPro ID).
    * Never enter the partner's connection ID into the local block's ID pin.

Parameterizing SFB 12 (BSEND) and SFB 13 (BRECV)

To establish the data transfer handshake between AS 1 and AS 2:

Sending Side (AS 1)

Place BSEND (SFB 12) into a cyclic interrupt OB (e.g., OB35):
* REQ: Rising-edge trigger to initiate transmission.
* ID: Local NetPro Connection ID (W#16#0004).
* R_ID: 32-bit Relationship ID (e.g., DW#16#00000001).
* SD_1: Pointer to the source data block (e.g., P#DB100.DBX0.0 BYTE 256).
* Output pins DONE, BUSY, and ERROR monitor transmission status.

Receiving Side (AS 2)

Place BRECV (SFB 13) into cyclic execution:
* EN_R: Set to TRUE (enabled to receive incoming data).
* ID: Local NetPro Connection ID (W#16#0007).
* R_ID: Must match the sending R_ID exactly (DW#16#00000001).
* RD_1: Pointer to the destination data block (e.g., P#DB200.DBX0.0 BYTE 256).
* Output pin NDR (New Data Received) pulses TRUE for one cycle when fresh data arrives.

Bidirectional Communication and R_ID Pairing Rules

When AS 1 and AS 2 need to exchange data in both directions:

  1. Reusing the S7 Connection: A single S7 Connection between two CPUs can support multiple independent data streams simultaneously. You do not need to create multiple NetPro connections.
  2. Assigning Unique R_ID Values:
    * For transmission from AS 1 -> AS 2:
    • BSEND on AS 1 uses ID = 16#4, R_ID = DW#16#00000001.
    • BRECV on AS 2 uses ID = 16#7, R_ID = DW#16#00000001.
    • For transmission from AS 2 -> AS 1:
    • BSEND on AS 2 uses ID = 16#7, R_ID = DW#16#00000002.
    • BRECV on AS 1 uses ID = 16#4, R_ID = DW#16#00000002.
  3. The relationship ID R_ID pairs the sender and receiver blocks across the shared connection.

NetPro and Block Parameter Configuration Reference Matrix

The following table outlines the parameter relationships for cross-controller communication:

ParameterSending Station (AS 1)Receiving Station (AS 2)Parameter Meaning & RulesStation NetPro IDW#16#0004 (Local)W#16#0007 (Local)Each CPU enters its own local NetPro connection IDRelationship ID (R_ID)DW#16#00000001DW#16#00000001Must be 100% identical on both pairing blocksData PointerSD_1 (Source Data)RD_1 (Destination Data)Destination buffer must be >= Source buffer lengthControl TriggerREQ (Positive edge)EN_R (Continuous TRUE)Initiates transfer / enables receive bufferHandshake SignalDONE (Transfer OK)NDR (New Data Ready)Single-scan confirmation flags

Strict parameter pairing ensures reliable data delivery without communication faults.

Verification

To verify that AS-to-AS communication operates cleanly:
1. In NetPro, download the connection tables to both CPU 1 and CPU 2.
2. Put both controllers in RUN mode.
3. In NetPro, select CPU 1 -> PLC -> Activate Connection Status; verify that the connection line between AS 1 and AS 2 displays green.
4. In CFC on AS 1, toggle REQ = TRUE on BSEND; verify that DONE pulses TRUE and BUSY returns to FALSE.
5. In CFC on AS 2, verify that BRECV.NDR pulses TRUE and that the destination DB registers identical data without status errors (ERROR = FALSE, STATUS = 16#0000).

Limitations and Operational Precautions

  • S7 Connections cannot be established from a standard non-redundant AS to an S7-400H redundant AS using fault-tolerant connection types; use standard S7 connections if one partner is non-redundant.
  • S7-PLCSIM cannot simulate S7 fault-tolerant connections; use standard S7 connections for offline multi-station simulation.
  • Destination data blocks (RD_1) must be equal to or larger than the source data block (SD_1), or BRECV will abort with buffer overflow status 16#0013.
  • Always validate final license quantities, module availability, and MLFBs against the applicable Siemens catalog and authorized distributor quotation.

Engineer FAQ

What does status code 16#0001 mean on BSEND?

16#0001 indicates that communication was triggered and BSEND is currently active (BUSY = TRUE). Wait for DONE or check STATUS if ERROR = TRUE.

Can BSEND and BRECV communicate across different subnets?

Yes, provided IP routing is configured on the network switches and both CP 443-1 cards have default gateways defined in HW Config.

What is the maximum data length that BSEND can transmit in S7-400?

In S7-400 CPUs, BSEND can transmit up to 65,534 bytes (64 KB) in a single segmented transmission, automatically handled by the communication processor.

Technical References

Related Articles

Related Tags

  • AS-to-AS Communication
  • BSEND BRECV
  • NetPro S7 Connection
  • Local ID
  • Relationship ID R_ID
6 respuestas