AM243x INDUSTRIAL COMMUNICATIONS SDK  2026.00.00
PRP 1G Layer 2

Introduction

This example is a PRP (Parallel Redundancy Protocol) Layer 2 demonstration application with interactive throughput testing capabilities using ICSSG firmware.

PRP, like HSR, is a zero downtime industrial redundancy protocol that operates at Layer 2 and uses commercial off-the-shelf Ethernet communication chips and physical media. Unlike the PRP 1G demo which uses the LwIP stack, this Layer 2 demo focuses on PRP functionality with direct packet handling at the Ethernet layer and includes an interactive menu system for testing network throughput, packet loss, and redundancy performance with real-time statistics.

  • The implementation consists of
    • Firmware (provided as a binary)
    • ENET (Ethernet Driver)
    • HSR-PRP FWHAL
    • Application

Steps to Run the Example

Build the example

Build the RX Example

First, build the RX (receiver) board application:

  • When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).
    • Import CCS project for the required platform from here {IND_COMMS_SDK}\examples\industrial_comms\prp_1g_l2_demo
  • When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)
    • gmake -s -C examples/industrial_comms/prp_1g_l2_demo/am243x-evm/r5fss0-0_freertos/ti-arm-clang
    • gmake -s -C examples/industrial_comms/prp_1g_l2_demo/am243x-lp/r5fss0-0_freertos/ti-arm-clang

Configure MAC Address for TX Example

Before building the TX (transmitter) board application, you need to configure the destination MAC address:

  1. Load and run the RX board application (built in previous step) and monitor the console output
  2. Note the MAC address displayed in the startup logs (e.g., Host MAC address-0 : f4:84:4c:fd:be:9b)
  3. In the TX project, open prp_layer2_icssg.c
  4. Locate the testPacketBuffer array and update the destination MAC address with the MAC from your RX board:
static uint8_t testPacketBuffer[PACKET_SIZE] = {
// Destination MAC (replace with your RX board's actual MAC address)
0xf4, 0x84, 0x4c, 0xfd, 0xbe, 0x9b, // <- Update with RX board MAC
// Source MAC (placeholder address)
0x1C, 0x63, 0x49, 0x13, 0x7B, 0x52,
// EtherType (0x0800 for IPv4)
0x08, 0x00,
// ... rest of packet data
};

Build the TX Example

After configuring the MAC address, build the TX board application using the same method as the RX build above.

Prerequisites for Throughput Testing

For throughput and redundancy testing, this demo requires two boards configured as TX (transmitter) and RX (receiver):

HW Setup

Note
Make sure you have setup the EVM with cable connections as shown here, EVM Setup. In addition do below steps.

Hardware Topology

Connect both Ethernet ports of the two boards together to form a redundant PRP network loop:

TX Board RX Board
Port 1 <---------------> Port 1
Port 2 <---------------> Port 2

AM243X-EVM

  • Connect ethernet cables between both ICSSG ports on both EVMs as shown in the topology above

Ethernet cable for ICSS based ethernet

AM243X-LP

Note
AM243X-LP has two ethernet Ports which can be configured as both CPSW/ICSS ports.
  • Connect ethernet cables between both ICSSG ports on both LaunchPads as shown in the topology above

Ethernet cable for ICSS based ethernet

Run the example

Attention
If you need to reload and run the example again, EVM power-cycle is MUST.

CCS Configuration and Programming

  1. Open two instances of Code Composer Studio (one for TX board, one for RX board)
  2. Import the CCS projects for the required platform from {IND_COMMS_SDK}\examples\industrial_comms\prp_1g_l2_demo
  3. Follow the build steps in the previous section (build RX, configure MAC, build TX)
  4. Reset both TX and RX boards
  5. Create a Target Configuration in both CCS instances for your device
  6. Launch the target configuration and connect to the target
  7. Load the applications on the Main_Cortex_R5_0_0 core on both boards, see CCS Launch, Load and Run
  8. Run the applications on both boards
  9. You will see logs in the UART terminal as shown in the next section

Example Startup

Initial Startup Output

==========================
ENET Layer 2 PRP App
==========================
Enabling clocks!
EnetAppUtils_reduceCoreMacAllocation: Reduced Mac Address Allocation for CoreId:1 From 4 To 1
Mdio_open:318
Open MAC port 1
EnetPhy_bindDriver:1873
Open MAC port 2
EnetPhy_bindDriver:1873
PHY 3 is alive
PHY 15 is alive
LRE: Initializing lre object
initQs() txFreePktInfoQ initialized with 16 pkts
initQs() Allocating packets for RX queue 0
initQs() rxFreeQ 0 initialized
initQs() Allocating packets for RX queue 1
initQs() rxFreeQ 1 initialized
LRE: Open driver call
LRE: Enable Host Offload
Initializing NodesTable (32 buckets, 8 entries/bucket)...
NodesTable initialized
LRE: Open driver call completed
Host MAC address-0 : f4:84:4c:fd:be:9b
Enet has been started successfully
Icssg_handleLinkUp:2723
[0] link_callback==UP
==========================
PRP THROUGHPUT TEST
==========================
Select Mode:
't' - TX Mode (Transmit packets)
'r' - RX Mode (Receive packets)

Interactive Menu System

Once both boards are running, you'll see the main menu on each board's UART console. The demo provides an interactive menu for configuring boards as either TX (transmitter) or RX (receiver) for throughput testing.

Running Throughput Tests

Step 1: Configure RX Board

On the board you want to use as the receiver:

  1. Press r to enter RX Mode
  2. The board will display:
=== RX Mode Selected ===
Waiting for packets...
Press 's' to show statistics
Press 'q' to return to main menu
CPU Load monitoring task started (low priority)
  1. CPU load monitoring will start automatically, showing utilization every 1 second

Step 2: Configure TX Board

On the board you want to use as the transmitter:

  1. Press t to enter TX Mode
  2. Enter the number of packets to transmit (e.g., 1000000)
  3. Enter the packet size in bytes (64-1517, e.g., 384)
  4. The board will transmit the specified number of packets and display statistics:
Initiating transmission of 1000000 packets (size: 384 bytes)
Packet transmission completed
Packets transmitted: 1000000
Elapsed time: 7.837 seconds
=== Statistics ===
=== Host TX Throughput Statistics ===
Packets transmitted: 1000000
Bytes transmitted: 384000000
Elapsed time: 7.837 seconds
Throughput: 391 Mbps
================================
Press any key to return to main menu...

Step 3: View RX Statistics

On the RX board:

  1. Press s to display statistics
  2. The board will show:
=== Statistics ===
=== Host RX Throughput Statistics ===
Packets received: 999250
Bytes received: 383712000
Dropped packets: 750
Total expected: 1000000
Packet loss: 0.075%
Elapsed time: 7.837 seconds
Throughput: 391 Mbps
================================

Step 4: Continue Testing

  • On RX board: Press q to return to main menu
  • On TX board: The menu automatically returns after transmission
  • You can switch modes or run additional tests

Understanding the Statistics

TX Mode Statistics

  • Packets transmitted: Total number of packets sent
  • Bytes transmitted: Total bytes sent
  • Elapsed time: Time from first to last packet transmission
  • Throughput: Calculated as (bytes sent × 8 bits) / elapsed time in Mbps

RX Mode Statistics

  • Packets received: Successfully received packet count
  • Bytes received: Total bytes received without packet drop
  • Dropped packets: Number of packets dropped
  • Total expected: Received + Dropped packets
  • Packet loss: Percentage of dropped packets with 3 decimal precision
  • Throughput: Calculated as (bytes received × 8 bits) / elapsed time in Mbps

CPU Load Monitoring

The demo includes a background task that reports CPU utilization every 1 second:

1.000s : CPU load = 85.23 %
2.000s : CPU load = 87.45 %
3.000s : CPU load = 86.91 %
Note
To achieve 0% packet loss, reduce the transmission rate or add sleep delays between packets. The trade-off is lower overall throughput.

Performance Optimization Tips

  • Reducing Packet Loss: If experiencing high packet loss (>0.1%), consider:
    • Reducing the transmission rate
    • Adding delays between packet transmissions
    • Ensuring both redundant paths are properly connected
  • Improving Throughput Speed: To achieve best throughput performance, tune the DMA channel packet counts and the large pool packet count in the SysCfg tool. Open examples/industrial_comms/prp_1g_l2_demo/<device>/r5fss0-0_freertos/example.syscfg in the SysCfg GUI and follow these steps:
    1. In the left pane, navigate to TI Networking and select Enet (ICSS)
    2. Go to DMA Channel Config > Enet Tx DMA Channel and configure the TX channel:
      • CH0: PacketsCount = 8
    3. Go to Enet Rx DMA Channel and configure the 2 RX channels:
      • CH0: PacketsCount = 92
      • CH1: PacketsCount = 92
    4. Go to Packet Pool Config and set Large Packet Pool Size to 192
  • Packet Size: Different packet sizes will affect throughput; 384-byte packets typically achieve ~390 Mbps

Troubleshooting issues

  • If you see a valid MAC address and address and link_callback==DOWN is seen then
    • check the ethernet cable if it is properly connected

See Also

HSR-PRP FWHAL