platformio.ini:
platform = ststm32
board = genericSTM32F103C8
board_build.f_cpu = 36000000L
framework = arduino
upload_protocol = stlink
debug_tool = stlink
I can connect to the target with “STM32 ST-Link Utility” when using hardware reset:
15:02:15 : ST-LINK SN : 56FF…
15:02:15 : V2J34S0
15:02:15 : Connected via SWD.
15:02:15 : SWD Frequency = 4,0 MHz.
15:02:15 : Connection mode : Connect Under Reset.
15:02:15 : Debug in Low Power mode enabled.
15:02:16 : Device ID:0x410
15:02:16 : Device flash Size : 128KBytes
15:02:16 : Device family :STM32F10xx Medium-density
But I cannot connect to it from PlatFormIO / VSCode / Windows 10.
Neither programming (flashing)
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
hla_swd
Error: init mode failed (unable to connect to the target)
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked
*** [upload] Error 1
nor debugging:
undefinedC:\Users\user\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = stlink
PlatformIO: Initializing remote target...
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
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
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 1000 kHz
Info : STLINK V2J34S0 (API v2) VID:PID 0483:3748
Info : Target voltage: 2.903616
Error: init mode failed (unable to connect to the target)
.pioinit:13: Error in sourced command file:
Remote communication error. Target disconnected.: Success.
and
[Window Title]
Visual Studio Code[Content]
Failed to launch GDB: .pioinit:13: Error in sourced command file:
Remote communication error. Target disconnected.: Success. (from interpreter-exec console “source .pioinit”)[Open launch.json] [Cancel]
Versions:
Version: 1.50.1 (user setup)
Commit: d2e414d9e4239a252d1ab117bd7067f125afd80a
Date: 2020-10-13T15:06:15.712Z (3 wks ago)
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.18363
You're up-to-date!
PlatformIO 5.0.2 is currently the newest version available.
PLATFORM: ST STM32 (8.1.0) > STM32F103C8 (20k RAM. 64k Flash)
HARDWARE: STM32F103C8T6 36MHz, 20KB RAM, 64KB Flash
DEBUG: Current (stlink) External (blackmagic, jlink, stlink)
PACKAGES:
- framework-arduinoststm32 4.10900.200819 (1.9.0)
- framework-cmsis 2.50501.200527 (5.5.1)
- toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Does PIO connect using hardware reset? If not, how can it be enabled?