Introduction: STM32F103C8X Minimal Development Board + ST Link V2 + STM Workbench
How to get start with STM32? You have seen tutorial around "how to program STM32 using Arduino", but in this tutorial I am going to setup environment on STM Test bench for native development of STM32 microcontroller
Step 1: Development Board
STM32F103C8x is powerful ARM Cortex M3 microcontroller ( Datasheet). Having 64k of flash memmory and 20k of SRAM. it is suitable for small form factor devices. the development board I used here can be buy from ebay.in.
http://www.ebay.in/itm/STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-/132081076420
Step 2: ST Link V2
This programmer is clone of original ST link V2. It can support JTAG and SWD protocol for debugging. Its is very cheap programmer which can program STM8 and STM32 both microcontrollers. her also given pin names we are going to use 5 pins .
3.3v
Reset
DIO
CLK
GND
Download and install this drivers
Step 3: Hardware Connections
Connect board and ST link in following manner.
STLINK------>STM32 Board
pin1(Reset)---(R)
pin2(3.3v)---(3.3v)
pin4(T_SWCLK)--(DCLK)
pin6(T_SWDIO)--(DIO)
pin7(GND)----(GND)
Step 4: Install STM Workbench for Windows
Downlaod STM work bench from official website of ST semiconductors. It is free IDE for STM development.You need to sign up for download it.
Install it.
Step 5: Create Blinky Project to Blink LED
On board PC13 Pin is connected to LED we are goinig to blink it
Create new Project as shown in images
Step 6: Configure Project Path
navigate as shown in image.
It is important to configure minimum required path for project to avoid conflict with other utilities from GCC compilers.
I used this path variable
C:\Ac6\SystemWorkbench\plugins\fr.ac6.mcu.externaltools.arm-none.win32_1.13.1.201701261202\tools\compiler\bin;C:\Ac6\SystemWorkbench\plugins\fr.ac6.mcu.externaltools.arm-none.win32_1.13.1.201701261202\tools\make;C:/Program Files/Java/jdk1.8.0_77/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_77/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_77/bin/../jre/lib/amd64;C:\Windows\system32;C:\Program Files\Java\jdk1.8.0_77\bin;C:\Ac6\SystemWorkbench
Step 7: Write Main.c Code
Copy past following code into src>main.c
Download This Program And Build using build button
Step 8: Debugging
For load .elf file in controller you have to configure debugger. configuration shown in image
Step 9: Execution of Progrma
after successful open debug made. click on Play button and see break point hit. and observe the led on board star blink
7 Comments
4 years ago
For arduino STM32..look up STM32F103C8T6 Blue pill Arduino Guide make a copy and checkoff each step mine works perfect much easier.
Tip 4 years ago
please explain what we are doing as we follow your example pictures...example you show how to set up clock but why did you do it that way..explain what all the letters mean (HSE=high speed external)
5 years ago
Hello, I have a problem with flashing. :/
it says when I want to run the project:
Open On-Chip Debugger 0.10.0-dev-00005-g4030e1c-dirty (2017-10-25-10:55)
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_nsrst_delay: 100
adapter speed: 950 kHz
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.262275
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
Have anyone some advice?
6 years ago
I really enjoyed following along on your Instructable. I ran into a problem using Workbench when I tried to go into debug. It gave an error and would not reset or transfer the program to the board. I could transfer the bin file using the ST-LINK utility successfully.
I have used your program in the free version of Atollic TrueSTUDIO without any issues, but would like to get Workbench working.
Have you or anyone by chance run into this type of problem? I saw on the web where it was suggested to change the reset line in the .cfg file. It didn't work for me.
Reply 6 years ago
boingx can you post your debug log. It would help to track problem
6 years ago
Do you have a link to that tutorial for the stm32 with Arduino?
Reply 6 years ago
no I dont have any link but I can create it.