Communicate with Hardware Using Connected IO
You can use Connected IO to communicate with the IO peripherals on the hardware during simulation.
Simulation with Connected IO is an intermediate step in the Model-Based Design workflow that bridges the gap between simulation and code generation by enabling Simulink® to communicate with the hardware before deploying the model on the hardware. Connected IO enables you to modify your model design and monitor the effect of the modified design using the peripheral data from the hardware in a near real-time environment. You are not required to deploy the model on the hardware to monitor the effect of the modified design, which accelerates the simulation process.
Note
We recommend completing the hardware setup by entering c2000setup
at the MATLAB® prompt before performing Connected IO.
These sections explain:
How to Enable Connected IO
To simulate a model in Connected IO, perform the following steps:
Open a Simulink model.
Press CTRL+E to open the Configuration Parameters dialog box.
In the Configuration Parameters dialog box, select Hardware Implementation.
Set the Hardware board parameter to any TI’s C2000™ board listed in the Supported TI’s C2000 Boards and Blocks with Connected IO section. For example,
TI Piccolo F28004x
. This selection automatically populates the parameters in the Hardware board settings with the default values for the TI’s C2000 hardware.From the Groups list under Target hardware resources, select Connected IO.
Specify the port to which the board is connected, for example
COM5
.Click Apply. Click OK to close the dialog box.
Go to Hardware tab, click on
Run on Board
and select Connected IO (inputs/outputs mode).Optionally, you can change the rate of simulation by clicking Run with IO.
Note
The server for connected IO is built using
Texas Instruments Code Composer Studio (C2000)
toolchain irrespective of the toolchain configured in Model Configuration Parameters.
Supported TI’s C2000 Boards and Blocks with Connected IO
The Connected IO described here applies to the C2000™ Microcontroller Blockset on these TI’s C2000 boards and blocks:
Source blocks: Without Connected IO, these source blocks output zero during simulation. With Connected IO, these blocks read data from the peripherals of the hardware during simulation.
Sink blocks: Without Connected IO, these sink blocks do not have any role during simulation. With Connected IO, these blocks write data to the peripherals of the hardware during simulation.
TI’s C2000 Boards Source Blocks Sink Blocks TI Delfino F28377S LaunchPad
C2802x/C2803x/C2805x/C2806x/F28M3x/F2807x/F2837xD/F2837xS/F2838x/F28004x/F28002x/F28003x ADC
TI Delfino F2837xS TI Delfino F28379D LaunchPad TI Delfino F2837xD TI Delfino F2833x TI Delfino C2834x TI Piccolo F280049C LaunchPad TI Piccolo F28004x TI Piccolo F2807x TI Piccolo F2806x TI Piccolo F28069M LaunchPad TI Piccolo F2805x TI Piccolo F2803x TI Piccolo F2802x TI Piccolo F28027/F28027F LaunchPad TI F280x TI F28044 TI F2838x TI F28002x TI F280025C LaunchPad TI F280013x F280015x TI F28P65x TI F28P55x
How Connected IO Works
Connected IO creates a communication interface that enables the Simulink model and the IO Server to communicate with each other. The Simulink model resides in your computer, and the IO Server is an engine on the hardware that contains all peripheral functions. The transport layer formats and transmits the data using the communication interface.
This diagram shows the connection that the Connected IO creates between your computer and the hardware.
Communication with Connected IO
When you simulate a Simulink model in with Connected IO:
The device driver blocks (for example, C280x/C2802x/C2803x/C2805x/C2806x/C2833x/C2834x/F28M3x/F2807x/F2837xD/F2837xS/F2838x/F2838x-M4/F28004x/F28002x/F28003x GPIO Digital Input and C280x/C2802x/C2803x/C2805x/C2806x/C2833x/C2834x/F28M3x/F2807x/F2837xD/F2837xS/F2838x/F2838x-M4/F28004x/F28002x/F28003x GPIO Digital Output blocks) in the model request peripheral data from the IO Server.
The IO Server accepts the request and responds with the requested data. You can use any Simulink sink or dashboard block to view the received data. Using the peripheral data received, you can verify that your model design meets the requirements.
If necessary, you can modify the design by adding, removing, or replacing any block in the Simulink model.
After the model is modified, resimulate the model. During simulation, the data request from the model is communicated to the hardware. You can continue to modify and simulate the model until the expected behavior is achieved.
Note
The communication in Connected IO is an on-demand process. The hardware sends data only when receiving a data request from the Simulink model.
You do not have to build, deploy, and run the model on the hardware to monitor the effects of your changes in your model design.
How Connected IO Differs from External Mode (Monitor & Tune)
Connected IO and Monitor & Tune both enable you to communicate with the hardware during simulation. However, you use Connected IO and Monitor & Tune for different purposes. The table shows the actions that you can perform with each mode.
Action | Monitor & Tune | Connected IO |
---|---|---|
Obtain real-time data | You can obtain real-time data with Monitor & Tune. | Enable the Simulink Pacing Option to get near real-time data. |
Timing analysis of real-time data | Timing analysis of real-time data is possible because the Simulink model is running on the hardware in real-time. | Timing analysis of real-time data is not possible because the Simulink model is running in your computer and not on the hardware. |
Code generation | Code is generated on the hardware. | No code is generated. |
Connected IO in Model-Based Design
Simulink communicates with the hardware only when the code is generated and the model is deployed on the hardware in Monitor & Tune. Simulation with Connected IO is an intermediate step in the model-based design workflow that bridges the gap between simulation and code generation by enabling Simulink to communicate with the hardware before deploying the model on the hardware.
This Model-Based Design Workflow diagram displays a model-based workflow:
Create a Simulink model.
Simulate the model in:
Normal mode simulation without Connected IO: There is no hardware interaction and no code generation.
Simulation with Connected IO: The model communicates with the hardware. There is no code generation.
Monitor & Tune: The model is deployed on the hardware and generates code.
Deploy the model to the hardware.
Model-Based Design Workflow
Limitations
The outports, HRPWM option in ePWM block and the usage of interrupts are currently not supported for Connected IO.
Connected IO is currently supported only for
c28xCPU1
core which is set under Configuration Parameters > Hardware Implementation > Hardware board > Hardware board settings > Processing Unit.Connected IO is not supported for multiprocessor modelling.
Connected works with only timer 0 set as
scheduler interrupt source
.The digital compare events with sources other than TZ 1,2, 3 requiring ePWM XBAR is currently not supported in Connected IO.
Ensure that the pins used for the SCI module used by Connected IO are not used anywhere else in the model.
See Also
Troubleshooting Connected I/O | Signal Monitoring and Parameter Tuning over XCP on Serial