MATLAB Examples

Exchanging Ethernet Data with the F28M3x Concerto Processor

This example shows you how to use Embedded Coder Support Package for Texas Instruments C2000 Concerto processors to send and receive UDP and TCP messages using the ARM Cortex-M3 core of F28M3x Concerto processor.

Contents

Introduction

In this example you will learn how to use TCP/IP Send, TCP/IP Receive, UDP Send and UDP Receive blocks to send and receive Ethernet data with the F28M3x Concerto processor.

The Ethernet port on the Texas Instruments C2000 Concerto processors supports the IEEE 802.3 standard.

Prerequisites

We recommend completing the Getting started with Embedded Coder Support Package for F28M3x Concerto Processors.

Required Hardware

To run this example you will need the following hardware:

The F28M3x Concerto controlCARDs provide an Ethernet port. This port can be used for data communication using the uIP TCP/IP stack provided by TI ControlSuite.

Hardware and Network Configuration

In this task you will configure the hardware and network properties needed to run this example.

  • When using the F28M35 Concerto ControlCARD, ensure rows 1 to 15 of the connectivity MUX connector are shorted between the B and C lines using jumpers. This step routes the Ethernet pins to the ARM Cortex M3 core of the F28M35x Concerto processor. This step doesn't apply to the F28M36 controlCARD.
  • The default Configuration of the target models present in this example are configured to get an IP address at startup using DHCP. This workflow is compatible when both the host computer and the target hardware are connected to a router. If you wish to connect the board straight into your host computer with the Ethernet cable, assign the F28M3x board with a static IP address. The Ethernet settings are located in the Configuration Parameters of the model under Hardware Implementation -> Target Hardware Resources -> Ethernet. To choose a static IP address, uncheck the Enable DHCP for local IP address assignment. This will prompt you to enter the static IP and subnet mask. Ensure that the IP address and subnet mask are unique and appropriate.

Settings for Automatic IP Address Assignment using DHCP:

  • Connect the controlCARD with a network cable to a router for automatic IP address assignment. In this configuration, the host computer also needs to be connected to the same router. This can be done with a network cable or over WiFi.

Ethernet Settings for Static IP Address Assignment:

  • Connect the controlCARD with a network cable to the host computer. In this configuration, set the controlCARD with a static IP address.

Task 1 - UDP Communication between the Target and the Host Computer

In this task, you will run the Fault Tolerant Fuel Control System Example on the ARM Cortex M3 Core of the Concerto processor. The control algorithm runs on the target while the host runs a plant simulation of the system. The target and the host communicate via UDP. The target model receives the fuel system control sensors values from the host model and transmits back the calculated fuel mixture ratio to the host computer.

Models Involved in this Example

1. UDP Target Model

2. UDP Host model

Run the Model configured for the target on the hardware

1. Open the UDP target model. This model has been configured for TI Concerto F28M35x (ARM Cortex-M3). To configure the model to run on a different board like TI Concerto F28M36x (ARM Cortex-M3), change the selected Hardware board in the Configuration Parameters > Hardware Implementation pane.

2. Configure the network properties for the model as described in the previous task: Hardware and Network Configuration.

  • On the target UDP Send block, the remote IP port has to match the local IP port of the host model UDP Receive block.
  • On the target UDP Receive block, the local IP port has to match the remote IP port of the host model UDP Send block.

3. The UDP Send and Receive blocks on the target model are configured to do a transmit broadcast and receive from all IP address in the subnet. You can change this to send to a specific IP address and receive from a specific IP address if you know the IP address of the host computer.

4. On the UDP target model, press Ctrl+B or click on the Deploy to Hardware button to build, load and run the model on the target.

Run the Host Model and analyze the data

  • While the target model is running, run the UDP Host model to send simulated sensor data to the target and visualize the calculated response by the controller.

Task 2 - TCP Communication between the Target and the Host Computer

In this task, you will run the Fault Tolerant Fuel Control System Example on the ARM Cortex M3 Core of the Concerto processor. The control algorithm runs on the target while the host runs a plant simulation of the system. The target and the host communicate via TCP. The target model receives the fuel system control sensors values from the host model and transmits back the calculated fuel mixture ratio to the host computer.

Models Involved in this Example

1. Target TCP model

2. Host TCP model - This model requires Instrument Control Toolbox.

Run the model configured for the target on the hardware

1. Open the Target TCP model. This model has been configured for the TI Concerto F28M35x (ARM Cortex-M3) target. To configure the model to run on a different board like TI Concerto F28M36x (ARM Cortex-M3), change the selected Hardware board in the Configuration Parameters > Hardware Implementation pane.

2. Configure the network properties for the model as described in the previous task: Hardware and Network Configuration.

  • On the target TCP Send block, the local IP port has to match the port of the host model TCP Receive block.
  • On the target TCP Receive block, the local IP port has to match the port of the host model TCP Send block.

3. On the target TCP model, press Ctrl+B or click on the Deploy to Hardware button to build, load and run the model on the target.

Run the Host Model to receive and analyze the data

  • While the target model is running, run the Host TCP model to send simulated sensor data to the target and visualize the calculated response by the controller.

Summary

This example introduced the workflow for exchanging data between Host and the target via Ethernet Communication.