STM32F407VET6烧录出现flash download failed target dll has been cancelled

今天在通过stlink烧录一个长时间未用的STM32F407VET6 Black Board的时候, 出现错误
Internal command error
Flash download failed target dll has been cancelled

板子上缺失两个boot跳线帽, 将跳线帽加上, 短接Boot0与GND, Boot1与GND (默认接线), 之后问题依旧.

检查stlink连接状态, 在Options for target的配置中, 检查debug中的Use, 使用的是ST-link Debugger, 点开右侧的Settings, 在SW Device中能看到ARM Core Sight SW-DP设备, 所以ST-link连接是对的.

打开STM32 ST-LINK Utility, 点击连接, 依然出现Internal command error, 根据提示, 修改target->settings下的Mode为 Connect under reset, 依然不行.

偶然发现在按开发板上的reset键后, 在STM32 ST-LINK Utility中点击连接能连上, 此时尝试烧录一个hex, 依然报Internal command error.

尝试Full chip erase, 这次没有出现失败, 全部地址都被擦写为FF. 在这之后再尝试连接, 以及烧录hex, 一切正常. 在Keil MDK中进行烧录, 也恢复正常.

烧录后运行一段时间, 再次出现Internal command error错误.

考虑到这块开发板上有这么多外设, 怀疑是供电问题. 将ST-Link的3V3线断开, 用USB连接开发板的MiniUSB口, 之后再烧录, 恢复正常.

在网上搜到一个说明 https://os.mbed.com/users/hudakz/code/STM32F407VET6_Hello/shortlog/

Warning

Please notice that VDD_TARGET is not connected. That works with the ST-Link programmer but 
could potentially damage the target micro controller in case it's running at a lower voltage (e.g. 2V5) 
than the programmer (e.g. 3V3). That's why it's recommended to connect also the VDD_TARGET line when 
an external programmer such as a Segger J-Link is hooked up to program the board.

Provide power for the STM32F407VET6 board through a 3.3V pin, 5V pin or over a USB cable. 
(The VDD_TARGET pin on the NUCLEO board CON4 does not work as source of power).

Connect the NUCLEO board to your PC over a USB cable.

To program the STM32F407VET6 board, click on the Compile button and save the binary to the NUCLEO 
virtual disk

注意其中的第二段: 通过3.3V脚, 5V脚或者USB给 STM32F407VET6 板子供电, VDD_TARGET脚不能用于供电

另外, 记录一下ST-link与STM32F407VET6 Black Board的接线方式 - 注意: 连接MiniUSB后, ST-link只需要连3根线, 3V3这根不连.

原文地址:https://www.cnblogs.com/milton/p/15195429.html