Main Content

External Mode Using the STM32F4-Discovery Board

In this task, you will run the stm32f4discovery_external_mode model in External mode. When you are prototyping and developing algorithms, it is useful to monitor signals and tune parameters while the algorithms are running on the hardware. The Simulink External mode feature enables this capability.

The External mode simulation exclusively uses the serial communication interface. Therefore, if you are using the STM32F4-Discovery board, you must have the USB TTL-232 cable to run external mode simulations.

1. Open the stm32f4discovery_external_mode model.

2. Specify the COM Port as shown in the following figure.

3. Configure the model to perform Monitor & Tune (External mode), as shown.

4. Click Monitor & Tune.

After the model is loaded and running on the target, the External mode simulation begins. Double-click the Manual Switch block to change the input source. Double-click the Gain block to change the signal gain. Then, double-click the Scope block to view the External mode simulation results. The model is running in real-time on the target while performing these actions.

5. Stop External mode simulation, as shown.

Stopping the External mode simulation terminates the execution of the code running on the STM32F4-Discovery board.

Note: At any point during the course of the External mode simulation, you can open the External Mode Control Panel, as shown. The External mode control panel provides more options, such as the ability to connect and disconnect to the target without terminating the execution of the generated code.