STM32F4Discovery openocd connection PROBLEM SOLVED

Discussions and support about ChibiStudio, the free development environment for ARM.
Post Reply
andy_w
Posts: 1
Joined: Wed Jun 29, 2016 9:48 pm
Been thanked: 1 time

STM32F4Discovery openocd connection PROBLEM SOLVED

Post by andy_w »

Note: My STM32F4Discovery board from early 2015 does not have this problem. My mid 2016 board does.

Problem
1) Running on Windows 7-64 bit
2) Installed st-link driver STSW-LINK009.
  1. Verified that I could connect to the board using STM32 STlink Utility
3) Downloaded ChibiStudio_Preview17.7 and tried to connect to the STM32F4Discovery using openocd (either v2 or v2-1) and neither would connect.
  1. Openocd board file used C:\ChibiStudio\tools\openocd\scripts\board\stm32f4discovery.cfg. I tried that file for both STLink V2 and STLink V2-1 drop down options in the external tools menu (green play arrow with red toolbox). In both cases I received error:

Code: Select all

Open On-Chip Debugger 0.10.0-dev-00107-ge4848fe (2015-11-13-11:49)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html
Warn : Interface already configured, ignoring
Error: already specified hl_layout stlink
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 'init'
in procedure 'ocd_bouncer'

Solution
1) Copy C:\ChibiStudio\tools\openocd\scripts\board\stm32f4discovery.cfg to C:\ChibiStudio\tools\openocd\scripts\board\stm32f4discovery_V2-1.cfg
2) Edit C:\ChibiStudio\tools\openocd\scripts\board\stm32f4discovery_V2-1.cfg
  1. change 'stlink-v2.cfg' to 'stlink-v2-1.cfg'
  2. new file looks like:

Code: Select all

# This is an STM32F4 discovery board with a single STM32F407VGT6 chip.
# http://www.st.com/internet/evalboard/product/252419.jsp

source [find interface/stlink-v2-1.cfg]

transport select hla_swd

source [find target/stm32f4x.cfg]

reset_config srst_only

3) Now you can use STLink V2-1 and browse to stm32f4discovery_V2-1.cfg. This results in the expected connection to the board:

Code: Select all

Open On-Chip Debugger 0.10.0-dev-00107-ge4848fe (2015-11-13-11:49)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html
Warn : Interface already configured, ignoring
Error: already specified hl_layout stlink
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
Info : STLINK v2 JTAG v27 API v2 SWIM v15 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 2.891327
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints

Conclusion
Maybe older STM32F4Discovery boards have a STLink V2 interface and new ones have a STLink V2-1 interface.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F4Discovery openocd connection PROBLEM SOLVED

Post by Giovanni »

hi,

I asked for info, it is confirmed, newer F4 boards have an ST-Link 2-1 but the USART is not connected to the ST-Link (unlike nucleo boards).

Giovanni
Post Reply