Exchanging Ethernet Data with the F28M3x Concerto Processor
This example shows you how to use C2000™ Microcontroller Blockset to send and receive UDP and TCP messages using the ARM Cortex-M3 core of F28M3x Concerto processor.
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 C2000 Microcontroller Blockset for F28M3x Concerto Processors.
Required Hardware
To run this example you will need the following hardware:
F28M36 Concerto controlCARD or
F28M35 Concerto controlCARD
RJ45 Ethernet cable.
Optional router for automatic IP assignment.
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. To change the Ethernet settings, browse to Configuration Parameters > 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.
UDP Communication Between the Target and the Host Computer
In this task, you will run the Model Fault-Tolerant Fuel Control System 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. f28m35_UDP_target - UDP Target model.
2. f28m35_UDP_host - UDP Host model.
Run the Model configured for the target on the hardware
1. Open the f28m35_UDP_target 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 f28m35_UDP_target, 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 f28m35_UDP_host to send simulated sensor data to the target and visualize the calculated response by the controller.
TCP Communication Between the Target and the Host Computer
In this task, you will run the Model Fault-Tolerant Fuel Control System 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. f28m35_TCP_target - Target TCP model.
2. f28m35_TCP_host - Host TCP model.
This model requires Instrument Control Toolbox.
Run the model configured for the target on the hardware
1. Open the f28m35_TCP_target 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 f28m35_TCP_target 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 f28m35_TCP_host Host TCP model to send simulated sensor data to the target and visualize the calculated response by the controller.