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.
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:
Configure Network Settings on Raspberry Pi Hardware (Simulink Support Package for Raspberry Pi Hardware)
Get the IP Address of a BeagleBone Black Board (Embedded Coder Support Package for BeagleBone Black Hardware)
Create or open a Simulink model.
In your model, set the simulation stop time to
run the simulation until you explicitly pause or stop the model.
Select Tools > Run on Target Hardware. Then, select either Prepare to Run or Options.
In the Configuration Parameters dialog box, select the Hardware Implementation pane.
Set Hardware board to
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
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.
To apply any changes and close the dialog box, click OK.
In the Simulink toolbar, set Simulation
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.
Change any tunable parameters and observe how the changes affect application.
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.