Hi,
I have one unusual problem with STM32 Nucleo-L053R8 board (original board).
When I first time build and program it, everything works just fine. But, when I try to program it for second time I get error:
Error: init mode failed (unable to connect to the target)
Then I need to go to the STM32CUBE and program board with literary anything, and, when I return to the PlatformIO everything works fine. And then all over again.
Here is some data:
OS: Windows 10
Editor: VSC or CLion (the same behavior)
platformio.ini
[env:nucleo_l053r8]
platform = ststm32
board = nucleo_l053r8
framework = arduino
upload_protocol = stlink
Programming command :
openocd -d2 -s C:\Users\goran.platformio\packages\tool-openocd/scripts -f interface/stlink.cfg -c “transport select hla_swd” -f target/stm32l0.cfg -c “program {.pio\build\nucleo_l053r8\firmware.elf} verify reset; shutdown;”
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.11.0-00155-ge392e485e (2021-03-15-16:44)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 300 kHz
Info : STLINK V2J37M27 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.281213
Error: init mode failed (unable to connect to the target)
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked
*** [upload] Error 1
STM32CubeIDE log:
Open On-Chip Debugger 0.11.0-rc2+dev-00037-g4c4dbd9 (2021-02-09-13:39)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J37M27 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.276467
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : clock speed 4000 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x0bc11477
Info : STM32L053R8Tx.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : STM32L053R8Tx.cpu: external reset detected
Info : starting gdb server for STM32L053R8Tx.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : accepting ‘gdb’ connection on tcp/3333
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x08004d48 msp: 0x20002000
STM32L0: Enabling HSI16
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Device: STM32L0xx (Cat. 3)
Info : STM32L flash size is 64kb, base address is 0x8000000
Info : accepting ‘gdb’ connection on tcp/3333
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x08004d48 msp: 0x20002000
STM32L0: Enabling HSI16
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x08004d48 msp: 0x20002000
STM32L0: Enabling HSI16
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Warn : keep_alive() was not invoked in the 1000 ms timelimit. GDB alive packet not sent! (1003 ms). Workaround: increase “set remotetimeout” in GDB
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x08000900 msp: 0x20002000
shutdown command invoked
Info : dropped ‘gdb’ connection
shutdown command invoked
Any idea?
THX
Goran