How to connect kit stm32f411e discovery with simulink

3 views (last 30 days)
I'm trying toconnect kit stm32f411e discovery with simulink. I connect both stlink and uart wire but no success. i need help. i don't know how to connect board with computer to dowload code from simulink
My error: External Mode Open Protocol Connect command failed
Caused by:
  • Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command

Answers (1)

Raghava S N
Raghava S N on 4 Sep 2024
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.
Follow the instructions in the dialog box to successfully setup the hardware. Make sure to download the STM32CubeMX graphical tool as well. For more information about the hardware setup process, refer to the following link - https://www.mathworks.com/help/ecoder/stmicroelectronicsstm32f4discovery/ug/Getting-started-stm32cubemx.html#:~:text=Micro%20USB%20cable-,Run%20Hardware%20Board%20Setup,-Once%20you%20have.
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”.
Refer to the following link for an end-to-end example to generate, deploy and run code on STM32 targets - https://www.mathworks.com/help/ecoder/stmicroelectronicsstm32f4discovery/ug/Getting-started-stm32cubemx.html.
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!