I'm using STM32Cube IDE which is based on Eclipse. Nothing fancy in my code just initializes an on board LED and turns it on in infinite loop. It built and debugged successfully the first time(the LED did turn on) but the second time it could build but cannot debug.
Here's the error I got.
>Open On-Chip Debugger 0.10.0+dev-00021-g524e8c8 (2019-06-12-13:13)
>Licensed under GNU GPL v2
>For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
>Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
>adapter speed: 8000 kHz
>adapter_nsrst_delay: 100
>Info : Listening on port 6666 for tcl connections
>Info : Listening on port 4444 for telnet connections
>Info : clock speed 8000 kHz
>Info : STLINK v2 JTAG v25 API v2 SWIM v0 VID 0x0483 PID 0x3748
>Info : using stlink api v2
>Info : Target voltage: 2.891943
>Error: init mode failed (unable to connect to the target)
>in procedure 'init'
>in procedure 'ocd_bouncer'
When I try st-info --probe (on linux) I got:
Found 1 stlink programmers
serial: 390069063058303044662143
openocd: "\x39\x00\x69\x06\x30\x58\x30\x30\x44\x66\x21\x43"
flash: 0 (pagesize: 0)
sram: 0
chipid: 0x0000
descr: unknown device
But before upload I got relevant data eg:
flash: 131072 (pagesize: 1024)
sram: 20480
chipid: 0x0410
descr: F1 Medium-density device
No way of uploading code into microcontroller any way again. When I try new board it works just for that one upload - after that board is killed and works no more :( First upload of program works even after restart (LED is still blinking), but does not report to the ST-LINK v2.
I tried reset to default settings but it didn't help either. Has anyone ran into similar problems?
Found solution on Stackexchange.
When you forget to configure your debug port in STM32CubeIDE and upload your code, ST-Link will stop working, because its waiting for debugger to attach, but its not defined.
You have to assign SYS debug port in IDE (Configuration file -> SYS -> Mode -> Serial Wire): Setup image
You can make your STM32 work again by removing whole flash by ST-Link Utility (I tried that in linux but does not work because it does not support connect under reset). In ST-Link Utility go to Settings -> Mode -> Connect under reset. Then connect mcu with ST-Link and hold reset. After that click "connect to the target" in ST-link utility and you are ready to erase it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With