Error related to OpenOCD with Matlab206b

9 views (last 30 days)
Hello everyone, I'm using a STM32F4-Discovery and Matlab2016b. I've downloaded the Embedded coder support package for STM32F4. When I try to do an External Mode Simulation with a simple ADC Block and a Display Block, I've the following error :
  • The following error occurred during deployment to your hardware board: Error while writing the executable to the STM32F4 flash. OpenOCD returned the following diagnostic message:### Launching openOCD server "C:\Program Files\GNU ARM Eclipse\OpenOCD\0.9.0-201505190955\bin\openocd.exe" -f board/stm32f4discovery.cfg: readline() on closed filehandle $fh at C:\ProgramData\MATLAB\SupportPackages\R2016b\toolbox\target\supportpackages\stm32f4discovery\openOCD_client.bat line 69.Success### Open telnet port for communction with openOCD server.Unable to open a telnet connection to OpenOCD. If you are already connected to OpenOCD via a telnet or a GDB connection, please close the connection. For more information look in the logfile generated by openOCD: C:/Documents/MATLAB/matlab 2016b/STM32-Embeeded Package/test1/test1_ert_rtw/mw_openocd_log.txt. at C:\ProgramData\MATLAB\SupportPackages\R2016b\toolbox\target\supportpackages\stm32f4discovery\openOCD_client.bat line 162.*
I've seen many answers about this same issue but for less recent version of Matlab. Actually I don't have any C:Program\MATLAB\SupportPackages\2016b\openocd file in which I could rename the openocd executable file, so the solution given previously can't work here.
Regards
A.Steve

Answers (1)

Cesar Chavez
Cesar Chavez on 11 Jan 2018
Hi Steve, try with the following steps:
1. Open the folder "C:\Program Files\GNU ARM Eclipse\OpenOCD\0.9.0-201505190955\scripts\board"
2. Edit the file "stm32f4discovery.cfg" in a text editor.
3. Change the next line
source [find interface/stlink-v2.cfg]
to
source [find interface/stlink-v2-1.cfg]
4. Restart Matlab, open the simulink model and Deploy to Hardware.

Community Treasure Hunt

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

Start Hunting!