FlexCase
Simulink RPI MPU Setup
- Install and configure the Simulink support package for Raspberry Pi
- Configure a Simulink model to build onto the FlexCase
- Build a simple model to the FlexCase
The onboard Linux computer can be used as a secondary source of processing power. There are a multitude of ways to utilize the computer, including running standalone Simulink programs in parallel with the MCU.
This guide is more advanced than the basic tutorials, so please contact us if you have additional questions before proceeding.
Prerequisites
- This tutorial assumes that you have purchased a FlexCase with the Pro version, which includes can be configured with an onboard Raspberry Pi computer (Guide not applicable for Rockchip based platforms)
- Complete the quick start guide for a tutorial on connecting to the FlexCase and flashing binaries
- Complete the Simulink guide for building a model into a binary
- Complete the SSH connection guide
Install Support Package
- Open MATLAB Click on “get add-ons” from the main menu
- Install the add-on “Simulink Support Package for Raspberry Pi Hardware”. The support package for MATLAB will also be included in the installation
- DO NOT configure or set up the add-on once installed. More Info
Configure Simulink Model
Open the provided model MPUBasics.slx from the software downloads section. Once loaded open Hardware Settings/Hardware Implementation in Simulink and configure the model for your simulation.
Hardware board | Raspberry Pi |
---|---|
Device Address | yourHostname.local |
Username | pi |
Password | your SSH password |
Build Action | Build |
Build Directory | /home/pi |
Run on Boot | No (uncheck) |
SPI0 CEO Bus Speed (kHz) | 4000 |
Build and Run the Model
While connected to the FlexCase, you can run the RPi model in external mode for quick design iterations. Ensure that the communication interface is set to “TCP/IP” and not “XCP over TCP/IP” for scopes and data displays to function.
Change the Stop Time to inf and press Monitor & Tune to run the model on the FlexCase through the Simulink interface. For older versions of Simulink
We can see the model running by opening the scope and observing the incrementing value. Simulink may also indicate that the model is running with a “Running the model on Raspberry Pi” notification in the lower left corner.
Success!
You have successfully connected Simulink to the MPU for external mode simulation. You can now begin adding your custom applications to the FlexCase. We recommend reading how to do MCU co-processing below.