I am building a board with STM32F030F4P6TR, TSSOP20 20-pin package and am trying to figure out how I am going to flash my program onto this chip. It seems like there is a SPI interface that I might be able to leverage, but I am trying to understand what the tools/workflow are going to be for this purpose.

  1. Will I need a USB to SPI converter module to plug between my Linux box (where I will be doing the development/compilation using STMCubeIDE) and the SPI interface on the chip?

  2. Is there a simple module I could include/program on my PCB for this purpose? I know many of the Arduino boards have two micros on them, a larger one for running the application code, and another smaller one with a program written into its flash that talks to the USB port and controls/flashes the sent program onto the larger micro.

Does anyone know of any demos or tutorials that address this application for STM32 mircos?

  • \$\begingroup\$ Get an ST-Link or some other similar JTAG debugger. Not only will you be able to flash the micro, but you'll be able to step through your code and debug it properly when it doesn't work. \$\endgroup\$
    – brhans
    Commented Nov 13, 2022 at 20:25
  • \$\begingroup\$ Not sure I can enable JTAG on this chip? Maybe I'm misreading the datasheet. I guess the ST-Link will let me debug over USART as well, because it seems like that might work? \$\endgroup\$
    – Jack Frye
    Commented Nov 13, 2022 at 20:54
  • \$\begingroup\$ You don't need to enable JTAG. Actually it only has SWD, not full JTAG. ST-link does not debug over USART. \$\endgroup\$
    – Justme
    Commented Nov 13, 2022 at 21:00
  • \$\begingroup\$ SWD will also work just fine for programming & debugging \$\endgroup\$
    – brhans
    Commented Nov 13, 2022 at 23:02

1 Answer 1


You can't use the SPI, unless you write and program the chip with a bootloader you write that can program it via SPI.

The factory bootloader only supports UART. It can be used to flash new firmware. So if you have UART then you don't need anything else.

For actually developing code, you really want a JTAG debugger.

ST dev boards have one built-in, but for own PCBs just put a JTAG connector for programming and debugging, and buy a JTAG debugger.

  • \$\begingroup\$ Looking through the technical reference manual, I see something saying you can boot from USART on PA9/PA10. When I go to setup USART in CubeIDE, it wants the USART on PA2/PA3, which has me a bit confused. I don't see anything about JTAG. Can you use IO for JTAG. Don't see any way to set that up in Cube or any indication of what pins those would be in the default bootloader \$\endgroup\$
    – Jack Frye
    Commented Nov 13, 2022 at 20:45
  • \$\begingroup\$ Yes but it is not your program that runs, it is the bootloader that runs when flashing over serial. You must use the SWD pins for SWD (sorry no full JTAG, only SWD). \$\endgroup\$
    – Justme
    Commented Nov 13, 2022 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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