ST LINK Error (DEV_TARGET_HELD_UNDER_RESET)

Viewed 7034

So I'm using an STM32F103C8T6 board and it was working fine a few days ago but then tried to load a code with keil vision compiler these days and it showed this message STLINK Error(DEV_TARGET_HELD_UNDER_RESET). After that using the STM32CubeProgrammer also shows the same problem, only connects with the "hot plug" mode as you can see here

Its cleary a reset error, but I really dont know how it happened and don't find much resources on the internet with this problem and now I can't download any code in my stm32f103 board it shows this message

After researching on the internet found it might be soldering problem, but I dont think its the case, i'm only using the microcontroller, not any bread board circuit, and it was perfectly fine days ago. All my write and read protections checkboxes are unchecked in the STM32CubeProgrammer sections too.

I guy on the stcommunity just said "he went through all CPU pins and the board started working." but is it a problem with the pin reset? in the STM32F103C8T6 board it has a reset buton but how can a search a problem in it?

3 Answers

Ok, this is what I did and now it seems to be working (I'll try to be as descriptive as I can, so you or anyone who's got stuck into this can compare):

  1. I'm using STM32CubeProgrammer v2.6.0 under Ubuntu. The parameters to connect to the target are:
  • Port: SWD
  • Freq: 4000 kHz
  • Mode: Normal
  • Access Port: 0
  • Reset Mode: Software reset
  • Shared: Disabled
  1. I'm using an STM32f4 Discovery as a programmer, to achieve this the jumpers should be disconnected. It is supposed that SB11 jumper (under the board) should be unsoldered too, but as you will see I'm not using the reset line on SWD. The target (STM32F103C8T6) is powered independently (+3.3V).

  2. The connections between the target and programmer are the following:

  • Prog pin1 (VDD) --> NC
  • Prog pin2 (SWD Clock) --> PA14 (Pin#37)
  • Prog pin3 (GND) --> VSS (Pins# 23,35,47 and 9 if common digital analog ground)
  • Prog pin4 (SWD I/O) --> PA13 (Pin#34)
  • Prog pin5 (NSRT) --> NC
  • Prog pin6 (SWO) --> NC

I have access to the target's NSRT (Pin#7) through a push-button (this is important).

Once all this is ready, what I did was to press and hold the reset button, then press the connect button in STM32CubeProgrammer (without releasing the reset), and wait just two seconds, then release the reset. After this process, the target was connected and I was able to program it normally. The program will not run immediately, you need to push and release the reset button again.

Juliane - the (DEV_TARGET_HELD_UNDER_RESET) message means that something is holding nrst to ground. You can't do much apart from 'hot plug' when in this mode. If you have a reset button then it may have failed in a connected position which will pull NRST to ground defeating the internall pullup.

Can you check the resistance across you reset button in down and up position. I suspect it is 0 ohms (or at least lower than internall pullup resistor).

If you don't have a reset button then check to see what circuitry is around NRST and try to work out why its pulling to ground.

First you need to clear the existing flash memory it can be done with ST Link Utility or STM32CubeProgrammer

Hold down Reset button while clicking 'connect' on STM-Prog, then navigate to 'Erasing & Programming' and click 'Full chip Erase'

or

while holding reset click Full Chip Erase on ST Link Utility

After the chip is clean try setting the Debug to Serial wire this will allow to flash new code to the board multiple times without having to clear the flash memory or holding reset before upload

in Pinout & Configuration

enter image description here

or in stm32f1xx_hal_msp.c

enter image description here

Related