Affordable programmer for STM32 in January 2023 - Page 1
Forum section: electronics / general

author: Watth
author_rank: Frequent Contributor
timestamp: January 21, 2023, 12:44:27 pm
content: 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 toApplication 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:compatible clones, such as the likes you find on amazon or aliexpress, such ashttps://www.amazon.fr/AZDelivery-d%C3%A9bogueur-programmateur-aluminium-incluant/dp/B086TWZNMM/The problem is, AFAIKI it only supports SWD.go for aSTLINK V3for a higher budget (€50).a dubious clone that although says its brand is "OJV", but has ST's logo printed on it:https://www.amazon.fr/OVJ-St-Link-T%C3%A9l%C3%A9chargeur-d%C3%A9mulateur-STLINK/dp/B0786Q9Z44/or is it possible to use a nucleo-32 dev board as a programmer? I own one based on the F031K6 and one based on the L412KB.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

author: pcprogrammer
author_rank: Super Contributor
timestamp: January 21, 2023, 12:50:46 pm
content: 42But 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.

author: Siwastaja
author_rank: Super Contributor
timestamp: January 21, 2023, 01:49:43 pm
content: 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.

author: wasedadoc
author_rank: Super Contributor
timestamp: January 21, 2023, 03:46:19 pm
content: 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.

author: DavidAlfa
author_rank: Super Contributor
timestamp: January 21, 2023, 03:48:15 pm
content: 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.htmlwww.aliexpress.com/item/32669702891.htmlOr 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).

author: Watth
author_rank: Frequent Contributor
timestamp: January 21, 2023, 05:51:44 pm
content: Quote from: wasedadoc on January 21, 2023, 03:46:19 pmI 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.

author: Watth
author_rank: Frequent Contributor
timestamp: January 21, 2023, 05:57:01 pm
content: Quote from: DavidAlfa on January 21, 2023, 03:48:15 pmFor 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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: January 21, 2023, 07:51:25 pm
content: Quote from: Watth on January 21, 2023, 05:57:01 pmThat is a way of doing it, but once you have experiences the luxury of setting breakpoints and stepping through your code, you kinda get spoiledBut 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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 21, 2023, 07:55:17 pm
content: 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.

author: Siwastaja
author_rank: Super Contributor
timestamp: January 21, 2023, 08:12:56 pm
content: Quote from: Watth on January 21, 2023, 05:57:01 pmThat'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.

author: voltsandjolts
author_rank: Unknown
timestamp: January 21, 2023, 09:22:13 pm
content: 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.

author: Sacodepatatas
author_rank: Regular Contributor
timestamp: January 22, 2023, 12:51:34 am
content: The ST-Link V2 clone called "Baite" also support Jtag and SWIM

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 22, 2023, 12:58:42 am
content: 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.

author: AVI-crak
author_rank: Regular Contributor
timestamp: January 22, 2023, 11:36:11 am
content: 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.

author: Watth
author_rank: Frequent Contributor
timestamp: January 22, 2023, 03:40:51 pm
content: Thanks everyone who read and replied.I did what seams to be the simplest: bought an entry level nucleo-64 board for its STLINK.