Skip to main content
LubO_o
Associate
March 19, 2025
Solved

Most basic setup for SWD to work?

  • March 19, 2025
  • 3 replies
  • 779 views

Hello, i need help with na stm32l031k6, I want to just start the processor and read it with an st-link v2, I have connected BOOT0 to GND(i haven't added a 10k resistor, but that shouldn't be the problem ), NRST with pull-up 1k to VDD, VDDA and VDD are connected together. From what I read online I can pass without the external crystal because there is an internal one. So when I connect the VDD to 3v3 on the st-link, the GND to the st-link GND, SWCLK to PA14, SWDIO to PA13 and the chip isn't recognized. I have ruled out an faulty st link because it recognizes a blue pill f103 board. Please tell me if I am forgetting something

Best answer by LubO_o

Turns out I have switched the SWDIO and SWCLK pins, otherwise everything worked!

 

3 replies

Andrew Neil
Super User
March 19, 2025

Rather than try to describe your circuit in words, please use a schematic - it's far clearer.

You also need some decoupling caps.

See the datasheet and AN4467 for power supply connections.

https://www.st.com/resource/en/datasheet/stm32l031k6.pdf

https://www.st.com/resource/en/application_note/an4467-getting-started-with-stm32l0xx-hardware-development-stmicroelectronics.pdf

 


@LubO_o wrote:

 From what I read online I can pass without the external crystal because there is an internal one


Correct (although, strictly, it's not a crystal - it's an RC oscillator)

 


@LubO_o wrote:

 when I connect the VDD to 3v3 on the st-link


What ST-Link do you have?

Note that a genuine ST-Link does not provide power to the target

See: How to recognize a genuine ST-LINK/V2 versus a cloned one

In particular: https://community.st.com/t5/stm32-mcus/how-to-recognize-a-genuine-st-link-v2-versus-a-cloned-one/tac-p/703663/highlight/true#M965

 

PS:


@LubO_o wrote:

 the chip isn't recognized


Using what tools?

Show any error messages & logs you get.

 

Note that keeping your wiring short & tidy is important. Wiring should be kept short, neat, and direct - with the minimum of joints.

Be particularly wary of solderless breadboards, cheap "dupont" style headers, etc:

https://community.st.com/t5/others-hardware-and-software/quot-no-device-found-on-target-quot-trying-to-flash-xm125-radar/m-p/782641/highlight/true#M31139 

 

More tips on resolving debugger connection issues here:

https://community.st.com/t5/stm32-mcus/how-to-solve-debugger-connection-issues/tac-p/698105/highlight/true#M956 

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
TDK
Super User
March 20, 2025

The minimum required connections are GND, SWDIO, SWCLK, and the chip must be powered.

Perhaps a bad programmer or mismatched connections. Works on F103 doesn't mean it works on other chips.

"If you feel a post has answered your question, please click ""Accept as Solution""."
LubO_o
LubO_oAuthorBest answer
Associate
March 22, 2025

Turns out I have switched the SWDIO and SWCLK pins, otherwise everything worked!