(I put links in my question but I will explain in as much detail what my problem is so that you won’t need to use the links, they are just for reference)
Hi,
I am trying to follow this youtube tutorial (1. How to Program and Develop with ARM Microcontrollers - A Tutorial Introduction - YouTube), but he uses coocox IDE and windows. I am using VS Code, platformio on VS Code, and Ubuntu 16.04.4 LTS. I am trying to use an stlink-v2 and a bare stm32 f030r8t6 microcontroller(Newbiehack-Microcontroller-ARM-Stmicro-STM32F0R6-Withbreadboardinterface). My platform.ini file is:
[env:f030r8t6]
platform = ststm32
board = f030r8t6
framework = stm32cube
upload_protocol = stlink
And I created a custom config file called f030r8t6.json which I copied and modified from: (Unable to add custom board (STM32F030 Discovery ) with OpenCM3 - #3 by Krishna_Chaitanya):
{
"build": {
"core": "stm32",
"cpu": "cortex-m0",
"f_cpu": "48000000L",
"extra_flags": "-DSTM32F030x8",
"mcu": "stm32f030r8t6",
"variant": "stm32f030r8t6"
},
"debug": {
"default_tools": [
"stlink"
],
"openocd_target": "stm32f0x"
},
"frameworks": ["libopencm3","mbed","cmsis","spl","stm32cube"],
"name": "STM32F030R8T6",
"upload": {
"maximum_ram_size": 8192,
"maximum_size": 65536,
"protocol": "stlink",
"protocols": [
"jlink",
"stlink",
"blackmagic"
]
},
"url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103r8.html",
"vendor": "ST"
}
When I build the project everything works fine, but when I try to upload I get the following:
> Executing task: platformio run --target upload <
Processing f030r8t6 (platform: ststm32; board: f030r8t6; framework: stm32cube)
--------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > STM32F030R8T6
SYSTEM: STM32F030R8T6 48MHz 8KB RAM (64KB Flash)
DEBUG: CURRENT(stlink) EXTERNAL(blackmagic, jlink, stlink)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Checking size .pioenvs/f030r8t6/firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA: [ ] 0.3% (used 28 bytes from 8192 bytes)
PROGRAM: [ ] 0.7% (used 484 bytes from 65536 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, jlink, stlink
CURRENT: upload_protocol = stlink
Uploading .pioenvs/f030r8t6/firmware.elf
GNU MCU Eclipse 64-bits Open On-Chip Debugger 0.10.0+dev-00392-gbe9ef0b0 (2018-01-12-14:56)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.248936
Error: init mode failed (unable to connect to the target)
in procedure 'program'
in procedure 'init' called at file "embedded:startup.tcl", line 495
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked
*** [upload] Error 1
=========================================================== [ERROR] Took 0.85 seconds ===========================================================
The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it
I have been stuck on this for weeks and I’m very new so I don’t know what I’m doing. I really appreciate any help!