Loading...
 
Skip to main content

System Workbench for STM32


[resolved]failed to start debuuging on STM32F0308-Discovery board

Open On-Chip Debugger 0.10.0-dev-00272-gf17dc4a (2016-10-10-08:40)
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 '.
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
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 v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.921615
Info : stm32f0x.cpu: hardware has 4 breakpoints, 2 watchpoints
adapter speed: 1000 kHz
Error: timed out while waiting for target halted
TARGET: stm32f0x.cpu - Not halted
in procedure 'program'
in procedure 'reset' called at file "embedded:startup.tcl", line 478
in procedure 'ocd_bouncer'

    • Unable to reset target **

shutdown command invoked

------------------------------------
Error in final launch sequence
Failed to execute MI command:
load /home/nsun/gitRep/omniControllerSource/prjMngmnt/STM32F0308Discovery_030R8T6/maxMixOnSW4STM32/maxMixSTM32F0308Discovery030R8_OnSw4Stm32/Debug/maxMixSTM32F0308Discovery030R8_OnSw4Stm32.elf

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

Here are little more brief about the issue.
I had done the exact same procedure for another board of STM32F0Discovery, which using microcontroller of STM32F051R8, instead of STM32F030R8T6.
All debugging launching is fine, has no problem.

Previously when I play OpenOCD from command, I have similar experience. The board of STM32F0Discovery runs fine, but STM32F0308-Discovery runs into failed. However, by upgrade OpenOCD from 9.xx to 10.xx, I got rid of the problem, both board works fine.
I checked the version of OpenOCD, the latest one with SW4STM, or Ac6, it is v10.xx, so I was confused.

By my understanding, this more like a little problem on STM32F0308-Discovery, either on the built-in ST-Link, or the debugging core within STM32F030R8T6. But some workaround in OpenOCD config file should be able to fix this.

Could someone help? Please.

Hi,
Yes, the "workaround" is the same way as your reference.
The enssential problem comes from the difference between ST-Link v1 and ST-Link v2. The extra signal of NRST provided in ST-Link v2. If using ST-Link v1 but scriptting as ST-Link v2 to use NRST, you will encounter failure.


It looks an issue related to FlashErase .
It is a timing issue?

Hello,

Which OS are you working on ?
Which version of SW4STM32 plugins ?
v1.11.0 are the latest. Menu Help => "Check For Updates" to update them.

Can you try to import the demo program from Cube L0 HAL ?
I have the cube F0 HAL v1.6.0
The project is found under :
C:\Users\YourName\AppData\Roaming\Ac6\SW4STM32\firmwares\STM32Cube_FW_F0_V1.6.0\Projects\STM32F0308-Discovery\Demonstrations\SW4STM32\STM32F0308-Discovery_Demo

I just tried to import, build and debug it on a STM32F030R8 Disco board without any issue.
On Win 7 64 bits and v1.11.0 plugins.

Rgds,
Laurent

Hello,
Thanks for response.
OS version as
-------------
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial
-----------------
I have eclipse and plugins all updated to latest.

-----------------
Eclipse IDE for C/C++ Developers

Version: Neon.1a Release (4.6.1)
Build id: 20161007-1200

(c) Copyright Eclipse contributors and others 2000, 2016. All rights reserved. Eclipse and the Eclipse logo are trademarks of the Eclipse Foundation, Inc., https://www.eclipse.org/. The Eclipse logo cannot be altered without Eclipse's permission. Eclipse logos are provided for use under the Eclipse logo and trademark guidelines, https://www.eclipse.org/logotm/. Oracle and Java are trademarks or registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

This product includes software developed by other open source projects including the Apache Software Foundation, https://www.apache.org/.
----------------------------

ARM Compiler for MCU (for Linux 64 bits)

1.11.0.201610101240

OpenOCD (for Linux 64 bits)
1.11.0.201610101240

../.p2/pool/plugins/fr.ac6.mcu.externaltools.openocd.linux64_1.11.0.201610101240/tools/openocd/bin/openocd

I don't feel this isssue related to the firmware code itself, As I can download and debug/run the generated elf on STM32F0Discovery board, which similar to STM32F0308-Discovery but using STM32F030R8 instead of STM32F051R8.

At this moment, the all those hardware peripherals accessed by the code are common between STM32F0Discovery and STM32F0308-Discovery. So that I tried to download and debug/run the code generated for STM32F0308-Discovery on STM32F0Discovery board.

I tried to import STM32F0308-Discovery_Demo.

As I expected, the build all through, and failed at the same point when launching debugging.

--------------------------
Error in final launch sequence
Failed to execute MI command:
load /home/nsun/STM32Cube/Repository/STM32Cube_FW_F0_V1.6.0/Projects/STM32F0308-Discovery/Demonstrations/SW4STM32/STM32F0308-Discovery_Demo/Debug/STM32F0308-Discovery_Demo.elf

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


-----------------------------
OpenOCD launch command (run in /home/YourName/liveToolsTrack/liveEclipsewithPluginSW4STM32andCubeMX/cpp-neon/eclipse/../../../../.p2/pool/plugins/fr.ac6.mcu.debug_1.11.0.201610101240/resources/openocd/scripts/st_board):
/home/YourName/liveToolsTrack/liveEclipsewithPluginSW4STM32andCubeMX/cpp-neon/eclipse/../../../../.p2/pool/plugins/fr.ac6.mcu.externaltools.openocd.linux64_1.11.0.201610101240/tools/openocd/bin/openocd -f stm32f0308_disco.cfg -s /home/YourName/liveToolsTrack/liveEclipsewithPluginSW4STM32andCubeMX/cpp-neon/eclipse/../../../../.p2/pool/plugins/fr.ac6.mcu.debug_1.11.0.201610101240/resources/openocd/scripts/st_board -s /home/YourName/liveToolsTrack/liveEclipsewithPluginSW4STM32andCubeMX/cpp-neon/eclipse/../../../../.p2/pool/plugins/fr.ac6.mcu.debug_1.11.0.201610101240/resources/openocd/scripts -c gdb_port 3333

Hello,

Are you sure all debug launch are terminated, everything clean ?

Then, i don't know, can you try to program the target elf directly ?
Right click on Demo F030 prj and select menu Target => Program chip.
And try Target => Erase chip also if prog not working.

If this is still not working, can you try to do a mass erase with another tool like stlink utility on windows.

Rgds,
Laurent

I had managed to find a workaround by providing the OpenOCD configure instructions manually, replacing the config file from .p2/pool/plugins/fr.ac6.mcu.debug_1.11.0.201610101240/resources/openocd/scripts.

I'm not expert on OpenOCD and ST-Link v2, so many things remain unclear.
If there is expert and willing to discuss in detail, please let me know.
Thanks.
BNow


Hello,
Here is update.
I tried to upgrade firmware on ST-Link V2, which is built-in on STM32F0Discovery board and STM32F0308-Discovery board.
Both of them now are up to version of V2J28S0.
The behaviour remains the same.
I tried Target => Erase chip from Ac6 plugin, it failed on timeout on STM32F0308-Discovery board, but success on STM32F0Discovery.
I know it sounds like a problem on STM32F0308-Discovery board, but I have this board erase/programming fine by using another set of wrapper over OpenOCD 0.10.x . It seems the OpenOCD config file for STM32F0308-Discovery does NOT working reliably, could be the timing related issue cause it working for some boards but not others.

Hello,

I don't think the timings can be a problem.

Have you changed option bytes on this STM32 ?

What i suggest is to take STLink Utility and do a mass erase and also check that option bytes values are ok for debug (no write protections or read out protection).

Rgds,
Laurent

Will STLink Utility work on Linux/Ubuntu?

I don't feel that I have a bad hardware/board, since I have other set of software wrapper over native OpenOCD0.10.xx work fine with this board. I can erase/download/debugging .

I tried STLink Utility on Windows 10, erase chip and program a bin file, all works fine.

And then I get back to openstm32, it failed as same as previously.

Thanks.


Another update regarding erase and programming operation on STM32F0308-Discovery.

Run ST-Link Utility on Windows 10, the erase and programming operation all work fine. No problem.

Still on Windows 10, from cpp-neon Eclipse CDT with all Ac6 plugin install and updated, the Target => Erase chip failed.
The information as below

Open On-Chip Debugger 0.10.0-dev-00272-gf17dc4a (2016-10-10-09:38)
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 '.
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
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 v28 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.917955
Info : stm32f0x.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
adapter speed: 950 kHz
Error: timed out while waiting for target halted
TARGET: stm32f0x.cpu - Not halted
in procedure 'reset'
in procedure 'ocd_bouncer'



20:11:22 Build Finished (took 1s.268ms)



One more thing I like to report is that the Target => option is not available on the cpp-neon Eclipse CDT with all Ac6 plugin on Linux/Ubuntu.

caught in console:

Open On-Chip Debugger 0.10.0-dev-00272-gf17dc4a (2016-10-10-08:40)
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 '.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 950 kHz
adapter_nsrst_delay: 900
none separate
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v28 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.915101
Info : stm32f0x.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
adapter speed: 950 kHz
Error: timed out while waiting for target halted
TARGET: stm32f0x.cpu - Not halted
in procedure 'reset'
in procedure 'ocd_bouncer'



Info : device id = 0x20006440
Info : flash size = 64kbytes
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
adapter speed: 950 kHz
Error: timed out while waiting for target halted
TARGET: stm32f0x.cpu - Not halted
in procedure 'reset'
in procedure 'ocd_bouncer'


Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
adapter speed: 950 kHz
Error: timed out while waiting for target halted
TARGET: stm32f0x.cpu - Not halted
in procedure 'reset'
in procedure 'ocd_bouncer'



Error: Target not halted
Error: failed erasing sectors 0 to 7
Error: flash_erase returned -304
Error: address + size wrapped(0xffffffff, 0x00000004)
Info : dropped 'gdb' connection