Model-Based Ethernet Communications

What Is Model-Based Ethernet Communications?

The Simulink® Real-Time™ software supports communication from the target computer to other systems or devices using raw Ethernet (Ethernet packets). Raw Ethernet is a direct method to send and receive packets with the real-time application using the Ethernet protocol. To transfer data using Ethernet packets, you must manually create Ethernet frames. This topic assumes that you are knowledgeable about the IEEE® 802.3 standard.

By itself, raw Ethernet does not implement the TCP/IP or UDP standards. For information about modeling protocols built upon raw Ethernet, see Real-Time UDP.

Ethernet Hardware

Before you start, provide a dedicated Ethernet card on your target computer. A dedicated Ethernet card is to be used only for model-based Ethernet communications and not for communication between the development and target computers. Therefore, your target computer must have at least two Ethernet cards, one to connect the development and target computers, and one for model-based Ethernet communication. The Simulink Real-Time model-based Ethernet communication blocks support selected members of the following Intel® (Vendor ID 0x8086) chip families:

  • Intel 8255X

  • Intel Gigabit

PCI Bus and Slot Numbers

To use the model-based Ethernet blocks, specify the PCI bus and slot number of the dedicated Ethernet card in the Real-Time Ethernet Configuration block. To identify which Ethernet card is available:

  1. Boot the target computer with which you want to perform model-based Ethernet communications.

  2. Examine the startup screen on the target computer. Note the PCI bus and slot information on the bottom right of the status window. This information represents the Ethernet card that is installed on the target computer for dedicated communication between the development and target computers.

  3. In the MATLAB® Command Window, type

    tg = slrt;
    getPCIInfo(tg, 'ethernet')

    This command determines which Ethernet cards are installed in the target computer.

  4. In the list, find the Ethernet card with a bus and slot different from the bus and slot that are displayed on the target computer monitor.

  5. Note the PCI bus and slot of the free Ethernet card. Use the card for model-based Ethernet communications.

MAC Addresses

Several Ethernet blocks require you to enter MAC addresses. The MAC address must be vector-based. To obtain the vector-based version of a MAC address, use the macaddr command. This command converts a character vector-based MAC address to a vector-based one. For example:


[1 35 69 103 137 171]

When an Ethernet block requires a MAC address, you can enter either of the following in the address field:

  • Command macaddr('MAC address character vector'), for example:


  • Vector-based output from the macaddr command, for example:

    [1 35 69 103 137 171]

Network Buffer Pointers

The Simulink Real-Time Ethernet block library uses pointers to refer to network buffers. Blocks can pass pointers to these buffers as single uint32pointers. They can also refer to a chain of network buffer packets.

Filter Type and Filter Address Blocks

The Filter Type and Filter Address blocks accept a chain of network buffers as input. These blocks specify criteria that the drivers use while parsing each buffer on the chain. Based on these criteria, the drivers either pass the packets through the port or drop the packets. When using these blocks, create your models with filter blocks to pass data only from expected sources.

Execution Priority

The raw Ethernet blocks have the following execution priority, from first to last:

  1. Real-Time Ethernet Configuration

  2. The remaining raw Ethernet and network buffer library blocks

Simulink Real-Time Ethernet Block Library

To access the Simulink Real-Time Ethernet library blocks, in the Simulink Real-Time block library, double-click Ethernet. The Simulink Real-Time Ethernet library is displayed.

The Simulink Real-Time Ethernet library contains commonly used Ethernet blocks at the top level of the library. Use these blocks to create your models.

The Ethernet library also has a sublibrary, Network Buffers, which contains blocks specific to the management of Ethernet network buffers. The blocks in this sublibrary are core blocks for use in creating other subsystems. However, the top-level Ethernet blocks provide enough functionality for model-based Ethernet communications.

Related Topics