Problem
1) Running on Windows 7-64 bit
2) Installed st-link driver STSW-LINK009.
- Verified that I could connect to the board using STM32 STlink Utility
- 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
- change 'stlink-v2.cfg' to 'stlink-v2-1.cfg'
- 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.