Tune and Monitor Executable Running on Xilinx Zynq Platform

Overview of Using External Mode

You can use external mode to tune parameter values in, and receive data from, the executable while it is running on your hardware.

External mode enables you to tune model parameters and evaluate the effects of different parameter values on the executable while it is running on the hardware. Doing so helps you find the optimal values to achieve desired results. This process is called parameter tuning.

External mode accelerates parameter tuning because you do not have to generate code, build, and run the executable each time you change the value of a parameter. You can also use external mode to develop and validate your application using the actual data and hardware for which it is designed. This software-hardware interaction is not available solely by simulating a model.

This workflow lists the tasks required to tune parameters with external mode:

  1. Optional: Place one or more sink (Simulink) blocks in your model. For example, use Display or Scope blocks to visualize data, or use a To File block to log signal data.

  2. Configure the model to simulate in external mode with the executable.

  3. Run the executable on the Xilinx® Zynq® platform.

  4. Connect the model on your host computer to the executable running on the Xilinx Zynq platform.

  5. Optional: Observe data external mode sends from the executable running on the hardware to the sink blocks in the model on your host computer.

  6. Change parameter values in the model on your host computer that external mode applies to the executable running on the hardware.

  7. Find the optimal parameter values by adjusting the values and observing the results.

  8. Save the new parameter values, disable external mode in the model, and save the model.

See also: External Mode Simulation with TCP/IP or Serial Communication (Simulink Coder)

Configure Simulink Model for External Mode

  1. Verify that you are able to run an executable on the target hardware, as described in Build and Run Executable on Xilinx Zynq Platform.

  2. In the model, set Simulation mode to External.

  3. Set the Simulation stop time parameter, located to the left of Simulation mode on the model toolbar. The default value is 10.0 seconds. To run the model for an indefinite period, enter inf.

    Note

    When model stops simulating in external mode, the binary executable stops running on the hardware.

  4. Optional: To observe data that external mode sends from the executable to the model on the host computer, place one or more sink (Simulink) blocks in your model. To visualize data, attach Display or Scope blocks to signals in the model. To log signal data, use a To File block. Also review the options under the Simulation Data Inspector button.

  5. Click the Run button.

    External mode:

    • Runs the binary executable on the target hardware.

    • Runs the model on the host computer in external mode.

    • Establishes external mode communication between the executable and the model.

    Note

    If your model does not contain a sink block, the MATLAB® Command Window displays a warning message. For example:

    Warning: No data has been selected for uploading. 
    > In C:\Program Files (x86)\MATLAB\R2013a Student1\toolbox\
    realtime\realtime\+realtime\extModeAutoConnect.p>
    extModeAutoConnect at 17
    In C:\Program Files (x86)\MATLAB\R2013a Student1\toolbox\
    realtime\realtime\sl_customization.p>myRunCallback at 149

    You can disregard this warning or add a sink block to the model.

  6. Change block parameter values in the model on your host computer. External mode applies the new parameters values to the executable running on the target hardware. Observe the effects of those changes and optimize the parameter values.

    Any Simulink® Sinks blocks in your model receive data from the target hardware and display it on your host computer.

Tip

When you have finished tuning and monitoring your application, disable external mode by setting Interface to None.

Stop External Mode

To stop the model simulating in external mode, select Simulation > Stop, or click the stop button on the model toolbar.

If it is set to a finite period, the Simulation stop time parameter stops external mode when the period elapses.

Note

When model stops simulating in external mode, the binary executable stops running on the hardware.