This is a read-only archive of community.oshwa.org. If you find any issues or missing data, please email us or file an issue on GitHub.

I created a project by OpenSTM32 and I got some error

Alinga

Setup

I have an STM32F103C8T6 minimal eval board (see STM32F103C8T6 datasheet: http://www.kynix.com/uploadfiles/pdf8827/STM32F103C8T6.pdf).

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.

Code

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_StructInit(&gpio);
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
    delay(400);
    GPIO_ResetBits(GPIOC, GPIO_Pin_13); // LED OFF
    delay(400);
}
}

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
    http://openocd.org/doc/doxygen/bugs.html
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

Connections

  • 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)

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] 

set WORKAREASIZE 0x5000

transport select "hla_swd"

set CHIPNAME STM32F103C8Tx

# Enable debug when in low power modes
set ENABLE_LOW_POWER 1

# Stop Watchdog counters when halt
set STOP_WATCHDOG 1

# 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
set CONNECT_UNDER_RESET 1

source [find target/stm32f1x.cfg]

Run configurations screen