I have an STM32F103C8T6 minimal eval board (see STM32F103C8T6).

And I'm using an ST link like the picture below.

I installed System Workbench for Eclipse. I created my own project (C++, Empty Project, toolchains: Ac6 STM 32 MCU GCC), Series: STM32F1, Mcu: STM32F103C8Tx, Core: ARM Cortex-M3, Package: LQFP48, Memory ram: Size 0x5000, memory ROM: size 0x10000.


The code contains a system_stm32f10x.c file which was generated (or automatically included) by the IDE.

The program compiles ok:

  * @file    main.c
  * @author  Ac6
  * @version V1.0
  * @date    01-December-2013
  * @brief   Default main function.

#include "stm32f10x.h"
#include <stm32f10x_rcc.h>

void delay(int counter)
    volatile int i;
    for (i = 0; i < counter * 10000; i++) {}

int main(void)
    GPIO_InitTypeDef gpio;
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);

    gpio.GPIO_Pin = GPIO_Pin_13;
    gpio.GPIO_Mode = GPIO_Mode_Out_PP;
    gpio.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOC, &gpio);

    GPIO_SetBits(GPIOC, GPIO_Pin_13);

    while (1)
        GPIO_SetBits(GPIOC, GPIO_Pin_13); // LED ON
        GPIO_ResetBits(GPIOC, GPIO_Pin_13); // LED OFF

Upload by OpenSTM32

When I create a Run configuration (no changes made), and select Run I get the following error (in console):

Open On-Chip Debugger 0.10.0-dev-00302-gc211ca5-dirty (2017-07-03-10:41)
Licensed under GNU GPL v2
For bug reports, read
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 950 kHz
adapter_nsrst_delay: 100
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : vid/pid are not identical: 0x0483/0x374B 0x0483/0x3748
Info : using stlink api v2
Info : Target voltage: 3.231135
Info : STM32F103C8Tx.cpu: hardware has 6 breakpoints, 4 watchpoints
adapter speed: 950 kHz
Error: timed out while waiting for target halted
TARGET: STM32F103C8Tx.cpu - Not halted
in procedure 'program' 
in procedure 'reset' called at file "embedded:startup.tcl", line 478
in procedure 'ocd_bouncer'

** Unable to reset target **
shutdown command invoked


  • STlink SWDIO pin 2 -> pin 7 of JTAG
  • STlink GND pin 4 GND -> pin 4 of JTAG
  • STlink SWCLK pin 6 -> pin 9 of JTAG
  • USB -> USB ( STlink 3.3V pin 8 not connected, neither all other STlink pins)


enter image description here STLink

Debug configuration file

# This is an F103C8T6_Simple board with a single STM32F103C8Tx chip
# Generated by System Workbench for STM32
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)

source [find interface/stlink.cfg] 


transport select "hla_swd"


# Enable debug when in low power modes

# Stop Watchdog counters when halt

# STlink Debug clock frequency
set CLOCK_FREQ 4000

# use hardware reset, connect under reset
# connect_assert_srst needed if low power mode application running (WFI...)
reset_config srst_only srst_nogate connect_assert_srst

source [find target/stm32f1x.cfg]

Run configurations screen

enter image description here


I could send a program via the Link utility, see below. I don't see a blinking light, but maybe the program is incorrect.

However, this way is not very comfortable (and I don't see any program running). Also, I still cannot debug this way.

enter image description here

Program upload/verify


See my answer (to help others with the similar problem)

Thank you all very much for your answers and numerous useful remarks.

  • 1
    \$\begingroup\$ You really need to include a schematic of your development board, and specify the name or include the text of your openocd adapter script. \$\endgroup\$ Aug 7, 2017 at 21:17
  • \$\begingroup\$ @ChrisStratton I added the schematics (sorry for the bad picture, I have not so good light here). \$\endgroup\$ Aug 7, 2017 at 21:31
  • 2
    \$\begingroup\$ Download the ST-Link Utility tool and check that your ST-Link is working at all. \$\endgroup\$ Aug 8, 2017 at 8:17
  • 1
    \$\begingroup\$ Your hardware does not seem to use the RST line, thus you would need "reset_config none". \$\endgroup\$
    – Turbo J
    Aug 8, 2017 at 10:30
  • \$\begingroup\$ @Turbo I don't know yet wat reset_config non means, but I will this evening read more about all reset issues/handling \$\endgroup\$ Aug 8, 2017 at 10:32

4 Answers 4


Connections made: STlink SWDIO pin 2 -> pin 7 of JTAG STlink GND pin 4 GND -> pin 4 of JTAG STlink SWCLK pin 6 -> pin 9 of JTAG STlink 3.3V pin 8 -> pin 2 of JTAG

Resetting doesn't mysteriously happen. It is actually a direct connection into MCU reset pin from the jtag/swd which is missing in your configuration.

edit: That was wrong. See comment of Chris.

* update *

Emulation reset needs correct openocd config parameters, which are set for hardware reset currently. "srst" is all about system reset which is not about emulation. Also read the manual on the github carefully: Author makes the reset manually, pushing the reset button before issuing reset command and releasing within the wait-the-reset period of openocd.

Also removing the parameter "reset on connect" from the config file may ease things for such manual resetting.

So, the solution is either manual resetting, or correct parameters for emulation (If your chip actually has it; I had to strike the text above because of the conceptional error, I don't know if your chip has it) or adapting your stlink's reset signal into board.

  • 1
    \$\begingroup\$ Not necessarily. STM32's also support a command reset. Pretty much the only time you need the hardware reset is if there is a program loaded which disables (re-purposes) the SWD pins. \$\endgroup\$ Aug 7, 2017 at 21:02
  • \$\begingroup\$ I got the information from github.com/rogerclarkmelbourne/Arduino_STM32/wiki/… ... where I also connected 3.3V from the ST Link to the JTAG (pin 1) because I don't use USB. \$\endgroup\$ Aug 7, 2017 at 21:08
  • 1
    \$\begingroup\$ You probably shouldn't be trying to power the target board from the SWD adapter. It looks intended for 5v USB power itself, and backpowering the unknown internal regulator is a dubious thing. \$\endgroup\$ Aug 7, 2017 at 21:18
  • \$\begingroup\$ @ChrisStratton: I now put it via a USB cable, but still does not work (I adapter the question). \$\endgroup\$ Aug 7, 2017 at 21:39
  • \$\begingroup\$ @MichelKeijzers, see the update. \$\endgroup\$
    – Ayhan
    Aug 7, 2017 at 21:53

The problem is solved.

It is fixed by going to the Run Configurations, Debugger tab, Debugger tab, Mode Setup, Reset Mode: Change to Software system reset.

The underlying problem is that my STLink is V2, not V2.1 and this does not have an hardware reset.

  • \$\begingroup\$ No, your stick has a hardware reset output on pin 1, you just didn't connect it to the target, and don't need to if you use soft reset. \$\endgroup\$ Aug 9, 2017 at 0:37
  • \$\begingroup\$ @ChrisStratton What is the benefit of a hardware reset? Since this seems to work fine. \$\endgroup\$ Aug 9, 2017 at 8:19
  • \$\begingroup\$ The software reset won't work if the SWD pins have been disabled. In addition to software which does this intentionally, these chips seem to occasionally get there as a result of a failed firmware load. Asserting reset in conjunction with the establishment of the SWD connection can help cut that off before it takes effect, leaving the debugger in control. \$\endgroup\$ Aug 9, 2017 at 11:34
  • \$\begingroup\$ @ChrisStratton I don't understand everything that you wrote. I connected the SWD pins (afik). I noticed sometimes the IDE does not see the STM32 anymore, I just remove the USB power and restart it and it works... Or I press the button RST myself ... that would work well enough for me. \$\endgroup\$ Aug 9, 2017 at 12:41

It appears that your OpenOCD config file has an incorrect ProductID number. This number refers to the ST-LINK clone adapter you are using, not your specific microcontroller.

See this from your OpenOCD Console:

Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748

Info : vid/pid are not identical: 0x0483/0x374B 0x0483/0x3748

Notice the difference that I've highlighted. It's hard to tell the difference between an 8 and a B sometimes!

Since the ST-LINK clones should work the same, I doubt that this is your problem. But I'll leave the info here in case it helps somebody.

  • \$\begingroup\$ The PID here is that of the stlink (clone) SWD adapter, not the target MCU. There are several different PIDs, mostly they work the same way. \$\endgroup\$ Aug 7, 2017 at 21:03
  • \$\begingroup\$ I cannot find any of these numbers, except in the log file. \$\endgroup\$ Aug 7, 2017 at 21:05
  • 1
    \$\begingroup\$ @ChrisStratton, Thanks; of course you are correct. I'll leave my answer (after I tweak it) in case it helps somebody... \$\endgroup\$
    – bitsmack
    Aug 7, 2017 at 21:06
  • 1
    \$\begingroup\$ @MichelKeijzers You can find the OCD config file location by looking at the "Debugger" tab of the Run Configurations screen in Eclipse. There is a "Config option" which looks like -f filename.cfg. It likely ends in .cfg, but it may be different. Also, give it a try with a Debug Configuration instead of a Run Configuration. \$\endgroup\$
    – bitsmack
    Aug 7, 2017 at 21:19
  • 1
    \$\begingroup\$ Command reset not always works. I can't figure when, but sometimes i cant program and debug without it and without disabling the pins \$\endgroup\$ Aug 7, 2017 at 21:21

To work with ARM chips on Eclipse I use https://gnu-mcu-eclipse.github.io/ myself.

The configuration for STM32F103C8T6 using an ST-Link stick using that eclipse plugin would be

-f interface/stlink-v2.cfg -f target/stm32f1x.cfg

The PID 0x374B is for ST-Link V2.1. The Chinese sticks are ST-Link V2. So you have selected the wrong debugger interface. As you use a different eclipse plugin, I don't know where and how to configure that, but have a look at the selected debugger interface.

  • \$\begingroup\$ Thanks ... I couldn't find the -f but I have changed the option for software reset, now it looks like: # use software system reset reset_config none \$\endgroup\$ Aug 8, 2017 at 21:33
  • 1
    \$\begingroup\$ One other thing, I see your ST-Link is running firmware V17. I would recommend to update the firmware ( st.com/en/embedded-software/stsw-link007.html ) ( Updating works fine on clones, I have a dozen of them and never had problems ) \$\endgroup\$ Aug 8, 2017 at 21:42
  • \$\begingroup\$ Good point and indeed, the ST Link Utility already mentioned it... I now have v27: Info : STLINK v2 JTAG v27 API v2 SWIM v6 VID 0x0483 PID 0x3748 \$\endgroup\$ Aug 8, 2017 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.