2
\$\begingroup\$

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:

enter image description here

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.

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

2 Answers 2

1
\$\begingroup\$

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.)

\$\endgroup\$
1
\$\begingroup\$

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

connect to your PC using a UART cable, something like: https://www.amazon.com/FEANTEEK-TTL232R-Raspberry-Serial-Windows/dp/B08HLSS5T4/ref=sr_1_1_sspa?crid=M97RB5JFX9VD&keywords=uart+cable&qid=1666669462&qu=eyJxc2MiOiIzLjc1IiwicXNhIjoiMy42OSIsInFzcCI6IjMuMzIifQ%3D%3D&sprefix=uart+cable%2Caps%2C334&sr=8-1-spons&psc=1

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

\$\endgroup\$
2
  • \$\begingroup\$ Good info, but the question was already marked as answered and you are not answering the asked question. \$\endgroup\$
    – Justme
    Oct 25, 2022 at 4:13
  • \$\begingroup\$ 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. \$\endgroup\$
    – Velvel
    Oct 25, 2022 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.