OpenOCD stlink-bluepill problem on faster CPU

I have a set-up that run on my notebook (I5, 4 core) fine, a bluepill and stlink. I have 5 nucleo boards, can even debug (single step), all nucleo 64/144 works fine. Downloading never a problem, however, if I use my Ryzen (8 core) some stlinks works sometimes, some never, it seem like the faster CPU have a timing issue. I use Kubuntu. How can I slow OpenOCD within platformIO ?

It is somewhat unlikely that the Ryzen’s higher speed causes a problem. The computer communicates to the STLink via USB 2 and the USB speed does not change.

Can you provide a more detailed error description: What error message do you get? What actions do you execute that lead up to the error?

My ini file looks like this

[env:bluepill_f103c8]

platform = GitHub - platformio/platform-ststm32: ST STM32: development platform for PlatformIO
board = bluepill_f103c8
framework = arduino
board_build.core = stm32
;monitor_speed = 115200
;monitor_port = /dev/ttyACM0
build_flags =
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D USBCON
-D USBD_VID=0x0483
-D USB_MANUFACTURER=“Unknown”
-D USB_PRODUCT=“"BLUEPILL_F103C8"”
-D HAL_PCD_MODULE_ENABLED
-fexceptions

The response I get us : Note I added extra 5th line to connect the stlink reset to the bluepill reset line, this solved a lot of programming isssues

I use Roger generic_boot20_pc13.bin as bootloader.

Processing bluepill_f103c8 (platform: GitHub - platformio/platform-ststm32: ST STM32: development platform for PlatformIO; board: bluepill_f103c8; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: ST STM32 6.0.0 #89a8dd7 > BluePill F103C8
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 64KB Flash
DEBUG: Current (stlink) External (blackmagic, jlink, stlink)
PACKAGES:

  • framework-arduinoststm32 4.10800.200207 (1.8.0)
  • tool-dfuutil 1.9.190708
  • tool-openocd 2.1000.190707 (10.0)
  • tool-stm32duino 1.0.1
  • toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 10 compatible libraries
    Scanning dependencies…
    No dependencies
    Building in release mode
    Checking size .pio/build/bluepill_f103c8/firmware.elf
    Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
    RAM: [== ] 19.9% (used 4076 bytes from 20480 bytes)
    Flash: [==== ] 44.4% (used 29124 bytes from 65536 bytes)
    Configuring upload protocol…
    AVAILABLE: blackmagic, dfu, jlink, mbed, stlink
    CURRENT: upload_protocol = stlink
    Uploading .pio/build/bluepill_f103c8/firmware.elf
    xPack OpenOCD, 64-bit Open On-Chip Debugger 0.10.0+dev (2019-07-17-11:25)
    Licensed under GNU GPL v2
    For bug reports, read
    OpenOCD: Bug Reporting
    debug_level: 1

hla_swd
none separate

Error: timed out while waiting for target halted
embedded:startup.tcl:449: Error: ** Unable to reset target **
in procedure ‘program’
in procedure ‘program_error’ called at file “embedded:startup.tcl”, line 474
at file “embedded:startup.tcl”, line 449
*** [upload] Error 1
=================== [FAILED] Took 2.78 seconds ===================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

If I’m not mistaken, the output none separate means that software reset is used (instead of SRST or TRST). Have you tried without wiring up the reset?

I actually started without the reset, and added reset after I experience the problem, it worked miles better with the reset connected, like said in the original comment. It does works, sometimes. On my notebook I can download 20 times in a row without a problem, on my desktop I have like one in 10 success

Just something that may help: once the program is downloaded, I can single step, place break points etc, no problem. Usually with my experience is that it is just the opposite, easy to download difficult to single step.