This example shows you how to use Embedded Coder Support Package for Texas Instruments C2000 Concerto processors ARM Cortex M3 core for code verification and validation using External mode.
In this example you will learn how to configure a Simulink model to run a simulation in External mode.
Simulink External mode feature enables you to accelerate the process of parameter tuning by letting you change certain parameter values while the model is running on target hardware, without stopping the model. When you change parameter values from within Simulink, the modified parameter values are communicated to the target hardware immediately. The effects of the parameters tuning activity may be monitored by viewing algorithm signals on scopes or displays in Simulink.
This example runs on the ARM Cortex M3 CPU of the Concerto processor. We recommend completing the Getting Started with Embedded Coder Support Package for F28M3x Concerto Processors.
To run this example you will need the following hardware:
The Texas Instruments ControlCARDs provide serial over USB capabilities. This allows serial communication from the target to your host computer over the USB connection to the board. The controlCARDs also provide Ethernet capabilities. We will use both Ethernet and serial connections in this example to exchange data from Simulink to the target.
In this task, you will run a model in External mode. When you are prototyping and developing an algorithm, it is useful to monitor and tune the algorithm while it runs on hardware. The External mode feature in Simulink enables this capability.
The Embedded Coder Support Package for Texas Instruments C2000 Concerto processor supports serial and TCP/IP communication interface for External Mode on the ARM Cortex M3 core. The serial communication interface uses UART0 for External Mode. The TCP/IP communication interface uses the Ethernet port provided on the C2000 Concerto controlCARD.
You can access UART0 via the USB cable connected to the controlCARD through a virtual COM port. For more information on how to configure the Virtual COM port refer to this page. Note the COM port number of the USB Serial Port showing in your Windows Device Manager under Ports "(COM & LPT)"
1. Open the External mode model. This model has already been configured for the TI Concerto F28M35x (ARM Cortex-M3) target. To configure the model to run on TI Concerto F28M36x (ARM Cortex-M3) you can change the Hardware board in the Configuration Parameters > Hardware Implementation pane.
2. Choose the communication interface by navigating through Configuration Parameters > Hardware Implementation > Target Hardware Resources > External Mode > Communication Interface.
3. If you choose Serial communication interface, enter the COM port number corresponding to your controlCARD. * As an example, see the settings in the External Mode model as shown below. In this example Serial port COM1 is selected.
To set the serial baud rate, click on the UART0 group in the configuration parameters and enter the desired baud rate as shown below.
4. For External mode over Ethernet, the default Ethernet configuration uses DHCP for the target IP address assignment. To configure the target for Static IP address assignment, on the Ethernet tab, uncheck the Enable DHCP for local IP address assignment and enter the desired static IP address and subnet mask as shown below.
The Ethernet communication interface uses port 17725.
5. Click Apply and close the configuration parameters window.
6. Select External from the simulation mode drop down list present in the model's toolbar.
7. Click on the Run button to start the External mode simulation.
Wait for the model to build and load on the target. Once this is done, the External mode simulation begins. Double click the Manual Switch block while the simulation is running to change the input source. Double click on the Gain block to change the signal gain. Finally, double click on the Scope block to view the External mode simulation results. Note that the entire model is running on the target.
8. Stop External mode simulation:
Stopping External mode simulation terminates the execution of the code running on the F28M3x Concerto Processor. Before you can start another External mode simulation you need to run the generated code again.
If running External Mode over UART0, ensure that the COM port number entered in the Serial port parameter at Hardware Implementation > Target hardware resources > External mode is correct.
In the Model explorer, go to the Code > External Mode Control Panel and click on the 'Signal and Triggering' button. The default value of Duration parameter under Trigger Options Section is 10. You may need to change this value to 5 if the memory on the target is not enough to store 10 data points. For more information on the Duration parameter, refer External Signal Uploading and Triggering.
The recommended baud rates for external mode communication over Serial is 115200 or 9600.