STM32CubeIDE只能刷新一次,不能进行SWD调试 [英] STM32CubeIDE can only flash once, no SWD debugging

查看:9
本文介绍了STM32CubeIDE只能刷新一次,不能进行SWD调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几年来,我一直使用med在线编译器创建.bin文件,然后像这样使用ST-LINK/V2 USB加密狗在命令行中刷新它们,一切都运行得无懈可击:

st-flash write 01_blink.NUCLEO_F103RB.bin 0x8000000

今天我下载了STM32CubeIDE for Linux(Fedora 30),并开始使用枫叶迷你(STM32F103CBT6)浏览本教程。

https://www.digikey.co.nz/en/maker/projects/getting-started-with-stm32-introduction-to-stm32cubeide/6a6c60a670c447abb90fd0fd78008697

构建项目并开始调试运行后,我得到输出:

STMicroelectronics ST-LINK GDB server. Version 5.3.2
Copyright (c) 2019, STMicroelectronics. All rights reserved.

Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled

Waiting for debugger connection...
Debugger connected
      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.2.0                  
      -------------------------------------------------------------------



Log output file:   /tmp/STM32CubeProgrammer_2ZxzGk.log
ST-LINK SN  : 34006B063058373138650943
ST-LINK FW  : V2J34S7
Voltage     : 3.21V
SWD freq    : 4000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x410
Device name : STM32F101/F102/F103 Medium-density
Flash size  : 64 KBytes
Device type : MCU
Device CPU  : Cortex-M3



Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_Q2zZSF.srec
  File          : ST-LINK_GDB_server_Q2zZSF.srec
  Size          : 4648 Bytes
  Address       : 0x08000000 


Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 4]
Download in Progress:


File download complete
Time elapsed during download operation: 00:00:00.595



Verifying ...




Download verified successfully 


Target is not responding, retrying...
Target is not responding, retrying...
Target is not responding, retrying...
Target is not responding, retrying...
Target is not responding, retrying...
Target is not responding, retrying...
Target is not responding, retrying...
Target is not responding, retrying...
Target is not responding, retrying...
Target is not responding, retrying...
Error! Failed to read target status 
Debugger connection lost.
Shutting down...

之后,我无法再启动调试会话,因为我收到以下消息:

我可以看到LED像预期的那样闪烁,所以我知道程序实际上是对着电路板闪烁的。但我无法使用STM32CubeIDE进一步执行任何操作,当我像以前一样尝试通过命令行刷新时,现在也不起作用:

[root@localhost Downloads]# st-flash write 01_blink.NUCLEO_F103RB.bin 0x8000000 
st-flash 1.5.1-38-gc3577b5
2020-03-24T13:51:09 INFO common.c: Loading device parameters....
2020-03-24T13:51:09 WARN common.c: Invalid flash type, please check device declaration
  core status: unknown
Unknown memory region

幸运的是,我可以通过使用ST-Link实用程序(在Windows上)并在连接前按住重置按钮,然后执行完全擦除来返回起点,如下所述:

http://www.kerrywong.com/2012/08/02/the-dreaded-cannot-connect-to-st-link-error-message/

但显然,这不是完成任何生产性开发的可行情况。我做错了什么?

在Debug Configurations(调试配置)对话框的Debugger(调试器)选项卡中,我已经尝试将‘接口’设置为SWD(实际上已经是),我还尝试了‘Reset Behavior’(重置行为)的所有选项,但结果没有变化。

推荐答案

为什么总是发生这种情况?我为一些事情挣扎了几个小时,然后又花了20分钟用截图等方式尽可能简洁和清晰地提出问题,然后在帖子两分钟后我找到了答案,通常是在另一个答案中,不知何故,我在几个小时的搜索中从未看到过。我想我在上面问的问题有一半是这样结束的。

问题似乎是,除非您声明要使用SWD以及在哪些管脚上,否则默认情况下不会启用它。因此,一旦新程序被刷新,社会福利署的连接就会中断。我猜med程序在默认情况下保留了在标准引脚上使用社署,因此这从来不是一个问题。

无论如何,要避免这种情况,请返回到引脚分配和配置(在项目资源管理器中双击.ioc文件)。为SWD设置适当的管脚(PA13,在我的例子中为PA14),在‘System Core’下,点击Systems,并将Debug选项设置为‘Serial Wire’。

这篇关于STM32CubeIDE只能刷新一次,不能进行SWD调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆