Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

stm32 - ST LINK Error (DEV_TARGET_HELD_UNDER_RESET)

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...