cancel
Showing results for 
Search instead for 
Did you mean: 

help - stlink can not connect to target

deep_rune
Associate III

ive been trying to get my first board with a stm32 running. Im using an stm32f031k6 and an STlink v2 and I keep on getting the "can not connect to target" error. It seems like I can connect through the stlink utility to the programmer, and I've checked and double checked the connections between the board / programmer. Ive tried changing the utlity link options but no change, the only thing i can think of its a problem on the board so I have a few questions about the board layout -

  • im using connection via the reset, swclk, gnd, swdio and 3.3v - is this sufficient?
  • im using an external 20MHz crystal, is this ok? It seems to indicate you can go up to 32MHz on the datasheet
  • does the reset pin need a pull up or pull down, or do any of the other pins?
  • does the board need to be connected to the power in addition to the programmer for programming? (ive tried this both ways, neither works but its useful to know anyways)

any help much appreciated

4 REPLIES 4
Uwe Bonnes
Principal II

debug connections are enough.

Startup happens with HSI, si crystal does not mattere

No need for pull, but NRST needs 100 nf to ground

Device must have all power pind connected and decoupled with low impedance pathes.

Most often it is that the chip is simply non-functional in the circuit

Connections seem Ok

External clock is irrelevant, the chip does not start or use, checking the clock is not a signs-of-life test.

Reset can be left as is. Should be an internal pull-up, and should read High in a static state

BOOT0 should be pulled low, but is not critical to "No Target"

Make sure VDDA/VSSA are connected

Make sure NRST is High

External ST-LINK/V2 needs power on pin 1 or 2 of the header

Check part orientation

Check supply pins

Check netlist for orphaned or unconnected nodes, especially with naming/symbols for ground and power

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
LMI2
Lead

"can not connect to target" error." Try connect during reset or whatever it is called. Try different SW. STM32 ST-LINK Utility or Cube programmer may work.

The CPU is quite resistant to errors. A friend left out some power supply 100nF and I forgot to connect Vcaps together and used wrong size capacitors. But Cpu definitely breaks if you solder it 90 or 180 degrees off, I have tried those too. Should I say on purpose?

deep_rune
Associate III

thanks all, i got it sorted - i made my own cable and it had a short. It's all working 🙂