Can I program a STM32 over JTAG with a STM32F0 Discovery? - Page 1
Forum section: electronics / beginners

author: rthorntn
author_rank: Frequent Contributor
timestamp: May 05, 2025, 02:26:43 am
content: Hi,I've searched the web and I can't find anything relevant.I'm about to start soldering this uphttps://westlicht.github.io/performer/build/.According to the 2nd post herehttps://www.modwiggler.com/forum/viewtopic.php?t=214360&start=800I use JTAG to program it's STM32.So I have a STM32F0 Discovery and I read somewhere that it could be used as a programmer.I sourced the ribbon cable for the miniature 1.27mm 2x5 header.I would have assumed I could use some DuPont cables to connect the STM32F0 Discovery to the Performer JTAG and then use STM32CubeProgrammer to program it but I can't even find what pins you would use, the little passive 2.54mm to 1.27mm converter PCB has silkscreen showing VCC, KEY, TMS, TCK, TDO, TOI, RESET & 3xGND.Maybe I can't use the STM32F0 Discovery for JTAG, not sure.Totally confused.Thanks!

author: rthorntn
author_rank: Frequent Contributor
timestamp: May 05, 2025, 03:25:59 am
content: Putting the info I found here just in case someone else is searching for it, I think you use the first four Discovery SWD (CN3) pins:pin 1 (vdd) to vccpin 2 (swclk) to tckpin 3 (gnd) to gndpin 4 (swdio) to tms

author: amyk
author_rank: Super Contributor
timestamp: May 05, 2025, 05:49:09 am
content: Any USB MCU with appropriate firmware and enough pins can be used as a JTAG adapter; you just need to either find or write a suitable firmware.

author: darkspr1te
author_rank: Frequent Contributor
timestamp: May 05, 2025, 06:38:23 am
content: There are a few firmwares for stm32 that provide swd/jtag,a example is dirty jtag, another is ftdi2232 emulator ( i have working code for stm32f1 if you want for ftdi2232h emulator for F1 )darkspr1te

author: newbrain
author_rank: Super Contributor
timestamp: May 05, 2025, 08:26:57 am
content: Quote from: rthorntn, redacted by me on May 05, 2025, 02:26:43 amWell, not for JTAG out of the box, but why would you want to use JTAG?There is in general no reason to program modern Arm MCUs with JTAG, they all support the SWD two wires interface: you should not have any issue in programming the STM32F405.The ST-Link V2 on the F0 DISCO is perfectly OK for that, and you have already identified the right pins to use on CN3: SWDIO and SWCLK, plus of course GND, and possibly reset: Vcc should not be needed, as, according to the schematic of the F0 DISCO, R10 is not fitted, but it won't hurt.Just follow the instructions in chapter 4.2.2 of thediscovery manual, and use any suitable SW (such as STM32CubeProgrammer, or your development environment) to program the FW.If you want something more handy, ST-Link V2 clones can be found for very low prices, or one can splurge a bit more for a CMSIS-DAP MCU-Link, still quite cheap and with a native 8 pin 1.27mm connector (not an ST-Link, but a more generic debug probe/programmer).EtA: Note that if you want to use the HW reset (sometimes needed if particularly broken FW is loaded), SB19 and SB22 must be removed, as the manual suggest. I wouldn't bother unless/until "connect under reset" is needed.