Fullscreen
Loading...
 

System Workbench for STM32 Help

Forums » System Workbench for STM32» Connect to custom board STM32L053 - STLINK-V2 - SWD

Connect to custom board STM32L053 - STLINK-V2 - SWD

Hi ST world,

I have issues connecting to a STM32L053 using openstm32.

The connection configuration is: STLINK-V2 // SWD

I've created a project with appropriate parameters and tried many configuration for the debug configuration (changing Mi protocol)

But I only could get this error at debug session start (stopping at 93 %):

"""""""""
Error in final launch sequence
Failed to execute MI command:
load C:\\projects\\micropos_proto1\\Debug\\micropos_proto1.elf

Error message from debugger back end:
Error erasing flash with vFlashErase packet
Error erasing flash with vFlashErase packet
"""""""""

What did I do wrong ? Any ideas ?

For note, it's possible to connect to my board using STLINK32 utility and flash/verify of the binary I want to debug was succesful.

Thanks and regards,
Sylvain


Hi Sylvain,

Can you verify that no debug session has been already launched. Go to the Debug perspectie (Windows > Open Perspective > Debug (or Other... > Debug)) then terminate every opened sessions.

Can you also check in the task manager if an openocd.exe is still runnning in background ? If it is, kill the openocd process.

Then relaunch the debug. If the same error is displayed, please copy the openocd process output (on the Debug perspective, select the openocd process under your debug session, the output should be displayed on the console view).

Regards,
Kevin.


Hi Kevin,

Had the same issue. And killing the process openocd.exe solved the problem.

Thanks
Antish



Hi Kevin,

thanks for quick reply: I made what you suggested without more results but
here is the console log which is interresting:

Open On-Chip Debugger 0.9.0-dev-00101-g3a546c5 (2015-03-06-16:35)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v21 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.218397
Info : stm32lx.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : STM32L flash size is 64kb, base address is 0x8000000
undefined debug reason 7 - target needs reset
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1015). Workaround: increase "set remotetimeout" in GDB
Error: timed out while waiting for target halted
TARGET: stm32lx.cpu - Not halted
in procedure 'reset'
in procedure 'ocd_bouncer'

in procedure 'reset'
Error: timed out while waiting for target halted
TARGET: stm32lx.cpu - Not halted
in procedure 'reset'
in procedure 'ocd_bouncer'

in procedure 'reset'

Error: Target not halted
Error: failed erasing sectors 0 to 15
Error: flash_erase returned -304


Something wrong in my connection ? That's unlikely as it is ok with stlink-32 utility.
Do you have an idea how to halt the µc ?

Thanks and regards,
Sylvain


Sylvain,

Ran into this same problem today with the STM32L051 (Funny coincidence). I modified the custom .cfg file in the following way:

  1. reset_config srst_only srst_nogate

reset_config srst_nogate

I had noticed the NRST line was toggling with the ST-LINK Utility but not with the debugger. Removing the 'srst_only' triggered the debugger to use the NRST line and everything started working.

I hope that helps,
Bryan


I had similar problem but then discovered that my NRST line from ST Link V2 was broken. I just replaced the wire and it started to work again.

Furthermore, I would suggest to select the right JTAG device, sometimes both an ST-LinkV2 and a ST-LinkV2-1 are present in the SystemWorkbench at the window whose screenshot is attached to this reply. If you select the wrong one, OpenOCD says "Error: open failed" and then eclipse says "Error message from debugger back end:
localhost:3333: The system tried to join a drive to a directory on a joined drive.
localhost:3333: The system tried to join a drive to a directory on a joined drive."


Hello Bryan!

Apparently your solution works for other people, so I woiuld like to try it.
What do you mean by "I modified the custom .cfg". I mean, where is this .cfg file?
Do I have to find a file named ".cfg", starting with a . like some config files, or
is it a file like "openocd.cfg" with possibly another name?
I have tried ps -ax | grep openocd, but there is no reference anywhere.
Is it a file in the workspace?

Thanks,

Pascal


I am using the STM32L051 with the ST-LINK-V2

I seem to have this problem with the reset line - reset_config srst_only srst_nogate

I change the .custom.cfg file to remove srst_only

When I launch the debugger, it modifies the .custom.cfg file and puts it back

Where is this modification coming from?

Thanks in advance



Hi Bryan,

it works perfectly with your solution.
Thanks !!

Sylvain



Thank you for this post. I was having the same problem and this fixed it!


Hi ST world.
Wy project on stm32f415 worked with openocd 1.3. In after updating to version 1.4 it stopped work. Error:

Error in final launch sequence
Failed to execute MI command:
load D:\\Work\\Projects\\Makett_105\\STM32F415_ili9341\\Debug\\F415_ILI9342.elf

Error message from debugger back end:
Error erasing flash with vFlashErase packet
Error erasing flash with vFlashErase packet

I modified the custom .cfg file in the following way:
reset_config srst_nogate


But did not achieve the result.

Thank you in advance



Hi Andrey,

you shoudl try to dig in .cfg files that are in the AC6 gcc eclipse plugin. And notably in .\eclipse\plugins\fr.ac6.mcu.debug_1.3.0.201507241045\resources\openocd\scripts\target\stm32F4.cfg file.

Some reset / connection options are set in it (line 86)
You should check it's still what you want.

Hope that help,
Regards,
Sylvain


Your're spot on there, Sylvain.
That reference in the plugins folder (stm32fxx.cfg) overrides the one in the custom.cfg in the workspace -> I had same problem on different device.
Fixed it


I found also that you could also use the GUI to modify the .cfg file that is generated. I am posting the steps below in case they help anyone else:

  1. Right Click on the Project, Click Properties
  2. Click on "Run/Debug Settings"
  3. Select the pesky Launch Configuration that keeps generating with the srst_only in it & click "Edit"
  4. Click the "Debugger" Tab
  5. Go into the Configuration Script section and click "Show generator options..."
  6. Change the Reset Mode to "Software system reset" (or whatever change you'd like to make- this change fixed my errors)
  7. Click Apply


Hello,
I have the same problem with connecting to STMF405.
I've tried everything above, but nothing helped.
All the time I got error:

Error in final launch sequence
Failed to execute MI command:
load "C:\\STM32\\test1\\SW4STM32\\test1 Configuration\\Debug\\test1 Configuration.elf"

Error message from debugger back end:
Error erasing flash with vFlashErase packet
Error erasing flash with vFlashErase packet


Do you have any more suggestions?
Regards
Jedrzej


Do you solve the problem?
Error in final launch sequence
Failed to execute MI command:
load F:\\STM32-Workspace\\PX4Flow-SWD\\Debug\\PX4Flow-SWD.elf

Error message from debugger back end:
Error erasing flash with vFlashErase packet
Error erasing flash with vFlashErase packet


Hi,

Can "STM32 ST-Link Utility" connect and program your chip ?

Can you verify that no debug session has been already launched. Go to the Debug perspectie (Windows > Open Perspective > Debug (or Other... > Debug)) then terminate every opened sessions.

Then relaunch the debug. If the same error is displayed, please copy the openocd process output (on the Debug perspective, select the openocd process under your debug session, the output should be displayed on the console view).

If OpenOCD initialization fail in reset procedure, you might modify your OpenOCD custom configuration script (*.cfg under the project) as following

reset_config none (instead of "reset_config srst_only srst_nogate")

It did work for me when the Reset pin of the ST-Link is not linked.

Kevin.
Ac6


Hi Kevin,
I uninstall the "install_sw4stm32_win_64bits-latest" version, and install the " install_sw4stm32_win_64bits-v1.3" version, then modify my OpenOCD custom configuration script, it works perfectly, so I think it‘s a version of the problem, the last version has bugs.
Thank you!

Barry


Hello,

Can you please Update the plugins and let us know the result with the latest plugins ? Without modifying the cfg script.
And tell us which mcu.debug plugin version you have.

What is your board config ? STLINK V2 ?
Which STM32 device ?

There has been a change recently in the cfg files to connect under reset.
It should reconnect better for applications that are going in low power mode.

Regards,
Laurent



@jedrek1993
You have to select "Use local script" in debug configuration debugger tab and point to a new file with this content :

source find interface/stlink-v2.cfg

set WORKAREASIZE 0xC000
transport select "hla_swd"

source find target/stm32f1x_stlink.cfg

  1. use hardware reset, connect under reset

reset_config srst_only srst_nogate



I had the same problem and I removed "srst_only" from last line and it seems it's working great.



You should in Configuration Debug set:

Open OCD command:
"${openstm32_openocd_path}\openocd.exe" -s ${openstm32_openocd_script_path} -f interface/stlink-v2.cfg

Configuration Script:
D:\Ac6\SystemWorkbench\plugins\fr.ac6.mcu.debug_1.3.0.201507241045\resources\openocd\scripts\target\stm32f4x.cfg

See attached image.


It doesn't work!


Hello,

I updated AC6 framework to the last compiler + openOCD.
I can't connect anymore to my stm32l476 based board. (Modifying stm32l4.cfg reset configuration is no longer working)

It seems the reset configuration is forced elsewhere:
srst_only separate srst_nogate srst_open_drain connect_assert_srst


here is the complete openocd log.
======
Open On-Chip Debugger 0.9.0-dev-00418-g9afb8b4-dirty (2015-09-28-12:09)
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
Warn : use 'STM32L476.cpu' as target identifier, not '0'
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_open_drain connect_assert_srst
adapter speed: 1800 kHz
Info : clock speed 1800 kHz
Error: read version failed
in procedure 'init'
in procedure 'ocd_bouncer'
=======

Please help, I'm stuck in a rut !!
Thanks for your help,
Best regards,

Sylvain


Hello,

Can you tell us the config ?
ST-Link V2 and STM32L476 ?
Did you connect Reset line from ST-link to the L4 target ?

The change has been done to connect to the target under reset so you can reconnect to a device that is in low power mode for example.
The reset config changed is in stm32l4.cfg file.

Are you using SWD mode ?
If not, can you try in SWD.

Rgds,
Laurent


Hello,

I just tried to connect an external STLink V2 on a STM32L476 Eval Board (STLink V2 connected to the 25 pins HE10 connector) and i made 2 custom board with STLINK V2 in SWD or JTAG mode and i can debug with the 2 configs.

Can you add the arg -d to the openocd command and give the result of the log ?

Rgds,
Laurent



Page: 1/2  [Next]
1  2 
Show posts: