Author Topic: Affordable programmer for STM32 in January 2023  (Read 1822 times)

0 Members and 1 Guest are viewing this topic.

Offline WatthTopic starter

  • Regular Contributor
  • *
  • Posts: 241
  • Country: fr
Affordable programmer for STM32 in January 2023
« on: January 21, 2023, 12:44:27 pm »
Hi EEV people,
I'm a hobbyist looking into designing STM32-based boards.
One of my first goal is to program a simple STM32G030J6M6 as it is cheap. This particular model supports SWD.
I'm refering to Application note AN4989 STM32 microcontroller debug toolbox.
The thing is the basic programmer STLINK V2 is unavailable where it's convenient for me (otherwise shipping cost are prohibitive). My other options are:

What are you experiences on the subject? Is it worth cashing out for a genuine STLINK V3? Are the clones worth it? What's the answer to life the universe and everything?

Thanks for reading!
edit: i miswrote nano instead of nucleo-32 (because the nucleo I have are based on a nano format...). It's not as obvious as nucleo-64 boards as to how to use them as a programmer
« Last Edit: January 21, 2023, 06:04:22 pm by Watth »
Because "Matth" was already taken.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3700
  • Country: nl
Re: Affordable programmer for STM32 in January 2023
« Reply #1 on: January 21, 2023, 12:50:46 pm »
42

But kidding aside, yes the clone ST-link devices only do SWD, but for most projects it is enough. You can program the device and debug it.

Nowadays not as cheap as a couple of years back, but they work fine for me.

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8172
  • Country: fi
Re: Affordable programmer for STM32 in January 2023
« Reply #2 on: January 21, 2023, 01:49:43 pm »
STM32 MCUs have built-in UART bootloader. USB-"TTL" UART adapter thing costs like $2 from Ebay, and chances are high you already have one or two. If you have one, then this is free.

I started that way. Obvious limitations are lack of debugging (not needed), general crappiness of ST's bootloader (slow, not always working reliably), and lack of well maintained command line tools so prepare to make small modifications (I use stm32flash, https://github.com/stm32duino/stm32flash ), like adding unsupported MCUs.
 
The following users thanked this post: Watth

Offline wasedadoc

  • Super Contributor
  • ***
  • Posts: 1365
  • Country: gb
Re: Affordable programmer for STM32 in January 2023
« Reply #3 on: January 21, 2023, 03:46:19 pm »
Or get one of the cheap Nucleo boards that has an onboard STLink v2.  Jumpers permit that to be used with your own board.  Can also snap it off from the main part of the Nucleo board.
 
The following users thanked this post: Watth, cfbsoftware

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5907
  • Country: es
Re: Affordable programmer for STM32 in January 2023
« Reply #4 on: January 21, 2023, 03:48:15 pm »
Get a ST-Link or a Jlink clone, the UART will only allow programming, but you really want debugging, it's *very* useful.

www.aliexpress.com/item/1005005142076263.html
www.aliexpress.com/item/32669702891.html

Or as @wasedadoc said, a inexpensive nucleo board will pack both the stm32 and the stlink (Which you can isolate from the board and use with whatever stm32 you want).
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: thm_w, Watth

Offline WatthTopic starter

  • Regular Contributor
  • *
  • Posts: 241
  • Country: fr
Re: Affordable programmer for STM32 in January 2023
« Reply #5 on: January 21, 2023, 05:51:44 pm »
Or get one of the cheap Nucleo boards that has an onboard STLink v2.  Jumpers permit that to be used with your own board.  Can also snap it off from the main part of the Nucleo board.
I corrected my initial post: I actually have nucleo boards but on the "nano" format (nucleo-32), making it not so obvious as to how tu use its integrated STLINK. I'm looking into that, and the option to buy a nucleo-64 board.
Because "Matth" was already taken.
 

Offline WatthTopic starter

  • Regular Contributor
  • *
  • Posts: 241
  • Country: fr
Re: Affordable programmer for STM32 in January 2023
« Reply #6 on: January 21, 2023, 05:57:01 pm »
Get a ST-Link or a Jlink clone, the UART will only allow programming, but you really want debugging, it's *very* useful.

www.aliexpress.com/item/1005005142076263.html
www.aliexpress.com/item/32669702891.html

Or as @wasedadoc said, a inexpensive nucleo board will pack both the stm32 and the stlink (Which you can isolate from the board and use with whatever stm32 you want).
For debugging I use a redirected print function, since I kept that (bad?) habit from Arduino. So I'm not 100% certain this means UART is enough.
Because "Matth" was already taken.
 
The following users thanked this post: Siwastaja

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3700
  • Country: nl
Re: Affordable programmer for STM32 in January 2023
« Reply #7 on: January 21, 2023, 07:51:25 pm »
For debugging I use a redirected print function, since I kept that (bad?) habit from Arduino. So I'm not 100% certain this means UART is enough.

That is a way of doing it, but once you have experiences the luxury of setting breakpoints and stepping through your code, you kinda get spoiled  :)

But if that is your way of doing it then a UART could be enough. Newer versions of the STM32 series also have programming via USB (DFU) and need neither to program the device, so you can also look into that.

One other benefit of doing it via SWD is it can be done without setting a different boot mode.

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14471
  • Country: fr
Re: Affordable programmer for STM32 in January 2023
« Reply #8 on: January 21, 2023, 07:55:17 pm »
Most STM32 MCUs having USB support DFU. Handy if you don't want to use any "programmer" at all.
It's usually just a matter of holding some specific pin to ground while resetting the MCU, and it enters USB DFU. Then you can use STM32CubeProgrammer to flash/erase/... the device. Or other DFU-compatible tools.

 
The following users thanked this post: Siwastaja

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8172
  • Country: fi
Re: Affordable programmer for STM32 in January 2023
« Reply #9 on: January 21, 2023, 08:12:56 pm »
For debugging I use a redirected print function, since I kept that (bad?) habit from Arduino. So I'm not 100% certain this means UART is enough.

That's fine, and you can grow with this pattern and let it evolve into true code instrumentation patterns, which are much more capable and scalable than single stepping code on a debugger. You don't have to start using a debugger just because "big boys" on the internetz tell you.

UART bootloader or USB bootloader as SiliconWizard mentioned is fine.
 
The following users thanked this post: SiliconWizard

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2300
  • Country: gb
Re: Affordable programmer for STM32 in January 2023
« Reply #10 on: January 21, 2023, 09:22:13 pm »
Search CMSIS DAP on ali-express, they are like $2, a USB to SWD interface for programming, debugging and include a usb-serial port too for easy printf debugging. So cheap I have a handful of them laying around.
 

Offline Sacodepatatas

  • Regular Contributor
  • *
  • Posts: 80
  • Country: es
Re: Affordable programmer for STM32 in January 2023
« Reply #11 on: January 22, 2023, 12:51:34 am »
The ST-Link V2 clone called "Baite" also support Jtag and SWIM
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3358
  • Country: nl
Re: Affordable programmer for STM32 in January 2023
« Reply #12 on: January 22, 2023, 12:58:42 am »
There is also an official ST-Link V3 which you can buy from "western" shops. Prices vary between about EUR12 and EUR25 depending on where you buy it.
« Last Edit: February 01, 2023, 10:23:52 pm by Doctorandus_P »
 

Offline AVI-crak

  • Regular Contributor
  • *
  • Posts: 125
  • Country: ru
    • Rtos
Re: Affordable programmer for STM32 in January 2023
« Reply #13 on: January 22, 2023, 11:36:11 am »
Now it is advantageous to have WCH-LinkE on CH32V305F. Work on two camps at once - arm and risk-v.
The speed is at the level of STLINK V3MINI, and the price is 16 times lower.
 

Offline WatthTopic starter

  • Regular Contributor
  • *
  • Posts: 241
  • Country: fr
Re: Affordable programmer for STM32 in January 2023
« Reply #14 on: January 22, 2023, 03:40:51 pm »
Thanks everyone who read and replied.
I did what seams to be the simplest: bought an entry level nucleo-64 board for its STLINK.
Because "Matth" was already taken.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf