stm32使用ST-link V2烧写程序出现Cannot reset target错误

  • Post author:
  • Post category:其他


程序在用ST-link V2 烧写的时候发生了下图错误。

我只用到了三个口:SWDIO,GND,SWCLK,没有用到RESET。


在这里插入图片描述

在这里插入图片描述

  • 百度知道的说法:

    当你的程序里使用了SWCLK和SWDIO这两个引脚,去作普通IO或其他的什么时,就需要接RESET了,否则不需要。

    最好还是接上,否则哪天程序写错用了那两个IO,就悲剧了,烧了一次就不能烧录第二次。
  • HW RESET performs a hardware reset by asserting the hardware reset (HW RESET) signal.
  • SYSRESETREQ performs a software reset by setting the SYSRESETREQ bit. The Cortex-M core and on-chip peripherals are reset.
  • VECTRESET performs a software reset by setting the VECTRESET bit. Only the Cortex-M core is reset. The on-chip peripherals are not affected. For some Cortex-M devices, VECTRESET is the only way to reset the core. VECTRESET is not supported on Cortex-M0 and Cortex-M1 cores.
  • Autodetect selects one of the above reset methods based on the target device. The SYSRESETREQ method is used if an unknown device is detected.

The Vector Reset resets the ARM Core.

The System Reset also resets the peripherals.

The Hardware Reset also resets the JTAG port.

Resetting the JTAG port can confuse a linked JTAG debugger, and is therefore not recommended.

For debugging, System Reset is the generally recommended option.


总而言之,修改上图红框内的内容就可以解决错误了。不过,HW RESET 有时候也会出错,还是推荐使用

SYSRESETREQ



版权声明:本文为AsCoolCucmber原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。