STM32 Program Download and Debug Problem

Written By 64pin on Thursday, August 10, 2017 | 8:16 AM

If you are on this page, you should have received the following error while debug or download the program on a STM32 :




Errors:
No target connected
Target DLL has been cancelled. Debugger aborted !
Flash Download failed - Target DLL has been cancelled

Also if you received these errors, you should did a lot of google searches to resolve these errors. The first suggestion will be:
"Press the reset button on your card and connect to the target board under reset. Select erase full chip and release the button."
This method works for download program to STM32 (not for debug), but you have to repeat it every time.
Solving:
The main reason for this problem is incomplete debug pins configuration. If you are using CubeMX, you can simply solve this problem. Select SYS->Debug->Serial Wire (or JTAG, it depends on your system)


Maybe you don't use CubeMX or you want to solve the problem with changing code. In this case, you should use the following code.

__HAL_AFIO_REMAP_SWJ_NOJTAG();  //If you are using Serial Wire

Write this code to your installation procedure that in main loop. If you are using CubeMX, write this code to stm32fxxx_hal_msp.c file and delete the following code.
__HAL_AFIO_REMAP_SWJ_DISABLE();

After that, build your program. Last time, erase full chip while press the reset button. Now you can do debug or program download without any problem.

OS: Windows 7
IDE: Keil uVision
Debug Probe: ST Link V2
ST Link Firmware Version: V2J24S4
Microcontroller: STM32F103ZE



SHARE

About 64pin

0 yorum :

Post a Comment