# Communicating with STM32L010F4P6 over SWD

After reading the reference manual for the STM32L010F4P6 it seems all I need to talk with the STM32L010F4P6 over SWD is

1. 3.3V on VDD (PIN 16)
2. GND on VSS (PIN 15)
3. GND on BOOT0 (PIN 1 - PB9)
4. Connect SWCLK (PIN 20 - PA14) and SWDIO (PIN 19 - PA13) lines to debugger

I have this circuit:

The cap between VDD and Gnd is a 0.1uF film capacitor.

I tried flashing the controller but was getting

Error: init mode failed (unable to connect to the target)
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked


So then I tried st-link --probe and got

Found 1 stlink programmers
version:    V2J29S7
serial:     56FF70067267495317140967
flash:      0 (pagesize: 0)
sram:       0
chipid:     0x0000
descr:      unknown device


It seems like the st-link is unable to connect to the chip. Is there something I'm missing in the documentation? I've been able to flash a stm32f103c8t6 with the same probe.

• This may be obvious, but #4 does not mention connecting GND to the debugger Sep 19, 2022 at 1:27

As is usual with STM32 MCUs, start with the: "Getting started with [STM32 model range] hardware development" document.

So in your case, it's the "Getting started with STM32L0xx hardware development" (AN4467).

You will see that your proposed schematic is missing at least 1 requirement stated by ST, which I've found that can prevent programming and debugging:

You have no supply connected to VDDA

See the note on page 7 of the above PDF:

VDDA and VSSA must be connected to VDD and VSS, respectively

There may be other problems - I don't have time for a deeper review right now. At least start with that issue and ensure your decoupling matches the stated requirements too.

(If your ST-Link is a clone, there may be another problem too.)

Hi I was looking for something else but came across your post. If you are still having issues though..

connect VDDA to your 3v3 This specific MCU gets flashed over UART using PA2, PA3

"The bootloader is located in system memory. It is used to reprogram the Flash memory by using SPI1 (PA4, PA5, PA6 and PA7) or USART2 (PA2, PA3)." Page 18 of datasheet

-In STM32CubeProgrammer: change the connection from [STLINK] (blue button) to UART, and connect.

• Good info, but the question was already marked as answered and you are not answering the asked question. Oct 25, 2022 at 4:13
• OP doesn't simply want to flash the STM32, but they want to use the debugging features. Check out chapter 24 'Debug support (DBG)' of the reference manual. Oct 25, 2022 at 5:43