Menu

#359 Unable to connect to stm8s105 targets. (Other stm8 targets work)

0.11.0
new
nobody
stm8s (2)
2022-08-16
2022-08-16
brad roy
No

I'm unable to connect to stm8s105 chips. Other stm8 chips - the stm8s103f3 works, and the stm8l151c6 also connects. I can connect and read/write to flash and opt on the same stm8s105k6 chips with the stm8flash tool, using the same stlink.

STM8s105.cfg
$ openocd -f interface/stlink-dap.cfg -f target/stm8s105.cfg
Open On-Chip Debugger 0.11.0-g228ede4-dirty (2022-07-25-13:51)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J17S4 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.235884
Error: stlink_swim_enter_failed (unable to connect to the target)

STM8s.cfg (with the '105 chip)
$ openocd -f interface/stlink-dap.cfg -f target/stm8s.cfg
Open On-Chip Debugger 0.11.0-g228ede4-dirty (2022-07-25-13:51)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J17S4 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.243799
Error: stlink_swim_enter_failed (unable to connect to the target)

writing flash with stm8flash (same chip/programmer)
$ stm8flash -c stlinkv2 -p stm8s105k6 -w ./Blink.ino.hex
Determine FLASH area
Due to its file extension (or lack thereof), "./Blink.ino.hex" is considered as INTEL HEX format!
1986 bytes at 0x8000... OK
Bytes written: 1986

(LED is blinking)

stm8l151c6
$ openocd -f interface/stlink-dap.cfg -f target/stm8l.cfg
Open On-Chip Debugger 0.11.0-g228ede4-dirty (2022-07-25-13:51)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J17S4 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.240633
Info : clock speed 800 kHz
Info : starting gdb server for stm8l.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to undefined, pc: 0x00006000

stm8s103f3
$ openocd -f interface/stlink-dap.cfg -f target/stm8s103.cfg
Open On-Chip Debugger 0.11.0-g228ede4-dirty (2022-07-25-13:51)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J17S4 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.237467
Info : clock speed 800 kHz
Info : starting gdb server for stm8s.cpu on 3333
Info : Listening on port 3333 for gdb connections

Discussion

  • brad roy

    brad roy - 2022-08-16

    Reset configuration seems to have helped, I set stm8s.cfg to 'connect under reset' and now I can connect at least, though after a random interval of some seconds, I get 'target halted due to undefined, pc: 0x00006000' ... although it seems to work fine otherwise. GDB connects, I can 'resume' things, etc. The 'target halted due to undefined' only occurs when I first connect. After I start debugging, things work as expected.

     

    Last edit: brad roy 2022-08-16
    • Tommy Murphy

      Tommy Murphy - 2022-08-16

      though after a random interval of some seconds, I get 'target halted due to undefined, pc: 0x00006000'

      If it's not actually a random period, is there any possibility that a watchdog timer is expiring and resetting/halting the target?

       
      • brad roy

        brad roy - 2022-08-16

        No, though I did go through and add some additional decoupling capacitors to the power and reset line, and I haven't seen an undefined halt since. I also added 'resume' to my openocd script, too. It does seem to be working well, I can flash and debug without anything unusual happening

         

        Last edit: brad roy 2022-08-16

Log in to post a comment.

MongoDB Logo MongoDB