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
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
hla_swd
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked
But from the second if fails with this output error message:
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
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
hla_swd
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
And the only way to erase the chip’s flash is to use the proprietary ST flasher tool.
What am I doing wrong?
Seems like the ST-Link isn’t able to reset the microcontroller. Either because it’s using the wrong method or pre-requisites for the method are not present.
Is the NRST of the STLink connected to the NRST of the target board?
Have you tried adding other reset configurations by adding to the platformio.ini
NRST is not connected to the STLink, but the strange thing is that first time works, from the second time stop working uploading method. But with proprietary method it works each time I erase or upload a new firmware.
Effectively last topic seems to be similar to mine.
this is the first uploading with
upload_flags =
-c
reset_config none
the log:
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
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 2000 kHz
Info : STLINK V2J35S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.196850
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
** Programming Started **
Info : device id = 0x10006431
Info : flash size = 512 kbytes
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked
It is not able to communicate to device anymore and I have to ease flash using STM32 Flasher (enable connect on reset, because normal mode fails)
Second time that I try to upload my firmware gives me this log:
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
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 2000 kHz
Info : STLINK V2J35S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.196850
Info : stm32f4x.cpu: hardware has 0 breakpoints, 0 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
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
Maybe the STM32Duino firmware disables SWD functionality at start (or you have to enable it explicitly). When you upload the firmware via the Arduino IDE, is the behaviour the same?
But with bluepill (stm32f1) works perfectly and it does the same if I use openocd from command line, but with the same stlink v2 and with the proprietary sw works perfectly.
Strange thing is that first time “seems” work, because it upload the executable, but the executable “don’t work”, the second time it is not accessible from openocd, and the only way to erase is with some tricks with proprietary flasher.
Maybe some other setting is wrong? For example memory address?
Yes, it works… Thank you very much, I looked at the 4 paragraphs for BlackPill in the upper part, but I didn’t see the configuration for the BlackPill V2 with STM32F411CE.
Thanks.