Hi John,
To successfully establish connection between Simulink and STM32 targets, a few pre-requisite setup tasks need to be completed.
Firstly, the hardware setup process must be performed, so that the latest drivers and supported firmware can be installed. To do this, run the following command in the MATLAB command window –
stm32cube.tools.launchHardwareSetup
The following dialog box will be launched.
The next step is to create the Simulink model and include all the blocks that are required. As the desired outcome is to run the model on STM32 hardware, a STM32CubeMX project must be created to configure the peripherals of the board being used.
Follow the steps below to create a model to support the STM32 processor-based board:
1. Open the “Modeling” tab and press “CTRL+E” to open the Configuration Parameters dialog box. Go to Hardware Implementation > Hardware board.
2. Select “STM32 Processor Based” board.
3. Go to “Build options” and click “Browse” to select an existing STM32CubeMX project file.
4. Click “Create” to create a new STM32CubeMX project file.
- Provide a project name with a “.ioc” extension.
- Browse to the desired folder location and save the project.
- Select the STM32 hardware and click “Apply” and “OK”.
Hope this helps!