STLink2 problems reseting

Open source ARM Debugger

Moderator: phalanx

STLink2 problems reseting

Postby NielsDanielsen » Sun Jan 15, 2017 1:51 pm

Im trying to get STM32F103, STLink 2.0, OpenOCD, Windows 10, and eclipse to work togeter.

I have several sets of the STMF103 2$ target, and STlink boards from AliExpress.

Some moths ago, i had everything running from Eclipse, build, upload, single step etc.
Then I had to enable some new peripheral on the STMF1x, and regenerated the project via. STMCube. (And I also updated the OpenOCD, the GNU toolchain, and the STM CMSIS, argh..)
Since I have not been able to get the darn thing to reset..

Old binaries:
Code: Select all
plugins\fr.ac6.mcu.externaltools.openocd.win32_1.11.0.201610101338\tools\openocd\bin\openocd.exe


New binaries:
Code: Select all
plugins\fr.ac6.mcu.externaltools.openocd.win32_1.12.0.201611241417\tools\openocd\bin\openocd.exe


New scripts:
Code: Select all
plugins\fr.ac6.mcu.debug_1.11.1.201611241417\resources\openocd\scripts
plugins\fr.ac6.mcu.debug_1.11.2.201612060912\resources\openocd\scripts


I have tried with both versions of the scrips, and can't see any difference..

I have connected the NRST from the ST-Link to the target HW reset pin. (Classic RC pullup reset circuit on target)

Error message from Eclipse, debug, launch dialog:
Code: Select all
Error message from debugger back end:
Error erasing flash with vFlashErase packet
Error erasing flash with vFlashErase packet


In eclipse terninal window the following output is seen:
Code: Select all
timed out while waiting for target halted
TARGET: stm32f1x.cpu - Not halted
in procedure 'program'
in procedure 'reset' called at file "embedded:startup.tcl", line 478
in procedure 'ocd_bouncer'

embedded:startup.tcl:454: Error: ** Unable to reset target **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 479
at file "embedded:startup.tcl", line 454


I have tried at lot of different things on my Windows 10:
- Testing with STM-32 ST Link utility (Works, can drive HW reset, checked on scope)
- Trying different reset_config settings (More on this later)
- Different target, and STLink boards. (No difference)
- Perform reeinstalation of complete toolchain in another folder, inc. OpenOCD (No difference)
- Starting openocd.exe from command line, and connect with putty. (Does not work, More on this later)

In have also tested on a Ubuntu 16.04 LTS
- Starting openocd from shell, and connect with telnet. (Works, can drive HW reset, More on this later)

The command “ocd_reset init” behaves different:
- On windows it fails, and it does not drive reset pin.
- On Linux it succeeds, and drives the HW reset.



In board.cfg file I have tried different reset configs:
Code: Select all
source [find interface/stlink-v2.cfg]
set WORKAREASIZE 0x5000
transport select "hla_swd"
source [find target/stm32f1x_stlink.cfg]

reset_config srst_only srst_nogate    (The configuration used in most tests)
reset_config srst_nogate       
reset_config trst_and_srst.
reset_config srst_only srst_nogate connect_deassert_srst



On Windows, Starting openocd.exe from command line, and connect with putty.
Code: Select all
Open On-Chip Debugger 0.10.0-dev-00267-g884c33c (2016-03-16-12:22)
Licensed under GNU GPL v2
For bug reports, read  http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_open_drain connect_assert_srst
srst_only separate srst_nogate srst_open_drain connect_assert_srst
3333
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v23 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.242133
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints


The folowing commands do not work on my windows configuration
> ocd_reset init
Code: Select all
timed out while waiting for target halted
TARGET: stm32f1x.cpu - Not halted


> program /stm32/Work/SmallBoard/Debug/SmallBoard.bin
Code: Select all
timed out while waiting for target halted
TARGET: stm32f1x.cpu - Not halted
in procedure 'program'
in procedure 'reset' called at file "embedded:startup.tcl", line 478
in procedure 'ocd_bouncer'

embedded:startup.tcl:454: Error: ** Unable to reset target **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 479
at file "embedded:startup.tcl", line 454



The folowing commands seems to work even on my windows box
> halt
Code: Select all
stm32f1x.cpu: target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x21000000 pc: 0x08003ab0 psp: 0x20000660


> flash probe 0
Code: Select all
device id = 0x20036410
flash size = 128kbytes
flash 'stm32f1x' found at 0x08000000


> stm32f1x mass_erase 0
Code: Select all
stm32x mass erase complete


> flash write_image C:\\stm32\\Work\\SmallBoard\\Debug\\SmallBoard.bin 0x08000000
Code: Select all
stm32f1x.cpu: target state: halted
target halted due to breakpoint, current mode: Handler HardFault
xPSR: 0x61000003 pc: 0x2000003a msp: 0x20004fc0
wrote 34748 bytes from file C:\stm32\Work\SmallBoard\Debug\SmallBoard.bin in 1.270945s (26.699 KiB/s)
keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1288). Workaround: increase "set remotetimeout" in GDB





Ubuntu 16.04 LTS, Starting openocd from shell, and connect with telnet
Code: Select all
Open On-Chip Debugger 0.9.0 (2015-09-02-10:42)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
3333
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v23 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.226333
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection on tcp/4444


> ocd_reset init
Code: Select all
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc


I'm stuck :?
Right now i'm trying to get BlackMagicProbe up and running on a STLink..
I have used one STLink to program another STLink with BlackMagicProbe DFU updater.
Can't get that to work either... (Can't reconnect via. USB after Openmoko DFU update)

Any ideas or suggestions on tings to try out..?
NielsDanielsen
 
Posts: 2
Joined: Sun Jan 15, 2017 12:46 pm

Re: STLink2 problems reseting

Postby Jambox » Tue Jul 11, 2017 1:02 am

very similar issue on my end, any resolution to this?
Jambox
 
Posts: 1
Joined: Tue Jul 11, 2017 12:59 am

Re: STLink2 problems reseting

Postby NielsDanielsen » Tue Jul 11, 2017 11:35 am

Jambox wrote:very similar issue on my end, any resolution to this?

No
I just tried to update the hole Eclipse environment today, still no success ....
NielsDanielsen
 
Posts: 2
Joined: Sun Jan 15, 2017 12:46 pm

Re: STLink2 problems reseting

Postby jaybee » Wed Jul 12, 2017 2:42 am

I had similar problem, but nothing worked. Just disabling HW reset solved the problem.

Code: Select all
reset_config none
jaybee
 
Posts: 4
Joined: Mon Aug 27, 2012 3:12 am


Return to OpenOCD

Who is online

Users browsing this forum: No registered users and 2 guests