OpenOCD-Error: Embedded Coder Support Package for STMicroelectronics Discovery Boards

35 views (last 30 days)
Sebastian Wendel
Sebastian Wendel on 9 Jul 2019
Commented: amr abdeltawab on 6 Dec 2019
currently I try to get an example of the " Embedded Coder Support Package for STMicroelectronics Discovery Boards" running in a STM32F429 Discovery Board.
I get 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:
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.
For more information look into logfile generated by openOCD: mw_openocd_log.txt.
The Logfile says:
GNU MCU Eclipse 64-bits Open On-Chip Debugger 0.10.0+dev-00254-g2ec04e4e (2017-11-10-11:34)
Licensed under GNU GPL v2
For bug reports, read
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Error: open failed
in procedure 'program'
in procedure 'init' called at file "embedded:startup.tcl", line 495
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked
Does anyone has an idea how to solve it? Can anyone help in setting it up for a new ST-Discovery-Board?
Thanky you very much, Best Ragards, Sebastian

Answers (2)

Sebastian Wendel
Sebastian Wendel on 9 Jul 2019
Edited: Sebastian Wendel on 6 Aug 2019
Mathworks sent me a tutorial,
Part 1) is about how to solve the issue with OpenOcd Config,
Part 2 ) Use the StLink instead
I haven’t managed to use the ST-Link(Part2), which I would consider better because it may be better maintained, but I have managed to make a LED blink on my Nucleo144 STM32F429 Board using OpenOCD. Please make sure that you use a port and a Pin that is connected to an LED, on mine (Nucleo144 STM32F429 ZI) I configured the Block to GPIOB, Pin14.
Ok, what I did was follow the instructions from Mathworks, but the first attempt failed. My solution is a combination of Mathworks but patching all STM32F4 related files to ST-Link 2.1:
(1) Go to the folder where your support packages are installed and go to the openocd-0.10.0 folder. For example, the default is; C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\openocd.instrset\GNU MCU Eclipse\OpenOCD\0.10.0-5-20171110-1117\scripts\board
(2) Open st_nucleo_f4.cfg , stm32f4discovery.cfg , stm32f429disc1.cfg , stm32f429discovery.cfg
(3) Change
[find interface/stlink-v2.cfg]
[find interface/stlink-v2-1.cfg]
(4) Save the files and restart MATLAB. Try the example again.
I’ll keep you updated, I’ll try to get the ST-Link as well.
Best Regards, Sebastian Wendel

mahdi akbari
mahdi akbari on 3 Aug 2019
hello i have same issue
and this solution dont work for me
amr abdeltawab
amr abdeltawab on 6 Dec 2019
i understood the second solution very well but in step 4 i can't understand what of mean patch here and how form enviroment variable, i can generate patch and extract it in a folder i think this is something missing for me

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by