Skip to main content
Associate III
August 23, 2023
Solved

STM32F411 Discovery board Blink LED program error simulink

I am trying to run the Getting started with stm32f4discovery project in matlab simulink. the code simple wont run. I tried multiple methods and answers however my error is always related to USB connection issues.
 
"Error while trying to establish USB communication with the STM32F4-Discovery board. Please reset the USB communication: 1. Disconnect the USB cable from the board. 2. Wait for three seconds. 3. Connect the USB cable again."
 
There is simply no information regarding the use of specific discovery f411 board, neither has MATLAB or STM have bothered to specify anything, the support package seems like namesake.
Has anyone worked specifically with this board and could support me in troubleshooting this?
Other than the specified steps from the example, there is a lot of external settings involved, I have updated the ARM compilier, STLink, STLink Firmware, MATLAB add ons are in place, tried with jumper on CN3 on and off also, however a simple LED program cannot be run. My board is showing up under USB seriel bus devices, no COM port no information regarding COM port, no ways to know how to use the STLink or the COM port.
 
Looking forward to your expert comments.
This topic has been closed for replies.
sanathhereBest answer
Associate III
September 12, 2023

Solved this by connecting USB TTL 232 cable to PA2 and PA3, which are the USART2 Tx and Rx and only those can be used for serial communication on this board. Also would suggest to create the CubeMX file from simulink, it is better that way to activate all the right components which simulink needs.

3 replies

RhSilicon
Lead
August 23, 2023

I don't know if it can help in your case, but I found these videos about advanced debugging:

STM32CubeIDE Advanced Debug Features
https://youtube.com/playlist?list=PLnMKNibPkDnEDEsV7IBXNvg7oNn3MfRd6

Associate III
September 6, 2023

Hello, I used the USB TTL 232 RPI cable then the COM port was listed but there is still error in communcation with simulink. 

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

How can i fix this? 

sanathhereAuthorBest answer
Associate III
September 12, 2023

Solved this by connecting USB TTL 232 cable to PA2 and PA3, which are the USART2 Tx and Rx and only those can be used for serial communication on this board. Also would suggest to create the CubeMX file from simulink, it is better that way to activate all the right components which simulink needs.