Run Model in External Mode

Use Simulink® external mode to connect your Simulink block diagram to your application that runs the model on the target hardware. The block diagram becomes a user interface to the real-time application. By changing parameters in the Simulink blocks, you also change parameters in the real-time application.

To run the model as a standalone application, see Run Model as Standalone Application.

Before starting this procedure:

  • Connect your board to the network and to a power supply.

    Note

    You must have an Internet connection from either the host connected to the target hardware or from the target hardware itself. This connection is necessary in case the software must update the firmware or drivers.

    If your Raspberry Pi™ or BeagleBone Black hardware is not connected to an Ethernet network, follow the instructions in the appropriate support package documentation:

  • Create or open a Simulink model.

Configure Model

  1. In your model, set the simulation stop time to inf to run the simulation until you explicitly pause or stop the model.

  2. Select Tools > Run on Target Hardware. Then, select either Prepare to Run or Options.

  3. In the Configuration Parameters dialog box, select the Hardware Implementation pane.

    1. Set Hardware board to Raspberry Pi or BeagleBone Black.

    2. Review the other parameters on this pane.

      • Raspberry Pi hardware:

        • If you performed a firmware update, Board information is populated with the IP address, user name, and password of your Raspberry Pi hardware. Make sure that the IP address contains the correct address for your hardware. If it is not correct or not present, see Get the Network Settings of the Raspberry Pi Hardware (Simulink Support Package for Raspberry Pi Hardware).

        • Verify that the TCP/IP port parameter is set to the default value 17725. Simulink uses this TCP/IP port to communicate with Raspberry Pi hardware.

      • BeagleBone Black hardware:

        Under Target Hardware Resources, verify that Device Address, Username, and Password are correct for your board.

    3. To apply any changes and close the dialog box, click OK.

Run in External Mode

  1. In the Simulink toolbar, set Simulation mode to External. Then, click Run.

    The model is now running on the target hardware. A system command window opens that shows the messages coming from the model running on the target hardware.

  2. Change any tunable parameters and observe how the changes affect application.

  3. In the model, click Stop in Simulink. The system command window opened in the previous step indicates that the model has stopped running. You can close this window.

Related Topics