Showing results for 
Search instead for 
Did you mean: 

How to program multiple STM32 MCUs over SWD (or otherwise) using one programming port

Associate III

Hello nice people.

I am supposed to develop a board that will have 2 STM MCUs (STM32F334 and STM32F01).

Is it anyways possible to be able to program both MCUs (simultaneously or individually) using a single SWD port. I know how to do it using JTAG chain (TDI -> TDO .....) but i don't know if it is also possible using SWD. Asking because many new processors don't support JTAG anymore but only SWD. THe aim is to use one programming port for both MCUs because of space restrictions.




It's not possible using a standard connector. You could use a set of jumpers in addition to the port to select which processor it connects to, but then you may as well just put two connectors if you go that route.

There are space-saving connectors out there that may be a better option.

If you feel a post has answered your question, please click "Accept as Solution".
Associate III

Thanks TDK.

After knowing that protocol wise it was not possible to do two MCUs using same SWD port, I set out to experiment. As it turns out, i don't actually need to have complete two separate ports having SWCLK, SWDIO and nRST, 3V3 and GND each. It is possible to "short" SWCLK, SWDIO and of course 3v3 and GND of both MCUs. THe only pin that needs to be addressed distinctly is the nRST port. So i just added another pin on the same port for 2nd MCU's nRST From a switch in the cable I can then physically select which of the two controllers will be targeted. In order to avoid manual hardware intervention from switch i could also multiplex the nRST line to both MCUs using a tiny SSR with NC to main MCU and NO to secondary MCU. using the main MCU to drive the SSR switch, I can route the nRST from cable to the nRST pin of second MCU. so in short.... problem solved.. though not as perfect as expected...

Thanks for the help guys.