使用ST-LINK下载程序 出现internal command error或Flash download failed - Target DLL has been cancelled或 Invalid Rom Table或Error: Flash Download failed - "Cortex-M4"问题原因及解决方案

一、原因

1、调试低功耗模式,掉电前未退出,导致internal command error
2、下载程序时,程序中的晶振频率没有使用得当(外部8M的晶振,程序中写成了25M等)
3、其它我也没遇到的原因。。。

二、我的解决方案

1、板子断电
2、按住复位按钮
3、板子上电
4、下载正常程序(不会引起原因1和2的程序)
5、如果未成功,重复执行1-4
6、实在未成功,没遇到过。。。

备注:

修改原因2的程序备注:
1、Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)"
修改stm32f4xx.h的123行(stm32f407)#define HSE_VALUE ((uint32_t)25000000)//((uint32_t)8000000) /*!< Value of the External oscillator in Hz */依据实际修改自己使用的晶振
2、system_stm32f4xx.c的316行#define PLL_M 25 // 8依据实际修改自己使用的晶振
3、修改"Option for target ‘xxx’"中的Target -> Xtal(Mhz)处的值(改为8MHz)。此处修改影响Debug时观察到的时钟数值,这个尽量修改一下

Logo

鸿蒙生态一站式服务平台。

更多推荐