I currently have a working electronic circuit using a "blue pill" STM32F103C8T6 board. It has/uses:

  • 3.3V regulated supply (though if the STM32 could handle the regulation and provide the regulated voltage for the peripherals, I wouldn't mind)
  • 1 SPI bus
  • 2 I2C buses
  • 2 Serial UART TX/DX links
  • 4 digital outputs
  • And still missing, some way to flash the STM32

I want to migrate it to a PCB design using a stand-alone STM32 MCU, not a dev board.

How should the MCU be wired ? Which parts of the "blue-pill" should be replicated and which ones are not needed ?

Circuit & STM32 functional diagram

Thank you.

  • \$\begingroup\$ can you be more clear about migrating? or If you wonder what to do to make MCU work properly this may help -> st.com/resource/en/application_note/… \$\endgroup\$ – emre iris May 13 '20 at 10:15
  • 1
    \$\begingroup\$ The answer would depend on what your requirements are. Do you need JTAG or SWD for programming or debugging? Or do you plan to use the internal bootloader for firmware programming? Do you plan to use the ADC? USB? What the etc part is exactly? \$\endgroup\$ – Justme May 13 '20 at 17:00
  • 2
    \$\begingroup\$ a link to a circuit would be a REALLY good idea. As would a list of identified functionality that does not depend on the mpu and which features you wish to retain or abandon. Otherwise it's just "put a bare mpu on a board, provide reset circuitry (if needed) & power. Done. \$\endgroup\$ – Russell McMahon May 14 '20 at 1:38
  • \$\begingroup\$ I have completed the question with the precise list of functionalities and a diagram. All the functionalities listed are required. Still missing the STM32 code flashing part that I haven't figured out, currently I am flashing the code through the blue pill USB port. In the final design I need to be able to flash it the same way, through an USB port, but I don't know how to interface USB D+ and D- with the bare STM32 for flashing it. \$\endgroup\$ – Alexandre Louisnard May 14 '20 at 8:51
  • \$\begingroup\$ Read the datasheet for the part and a few other reference manuals. The usb interface and how to program the part in general are among the easier things to find, which pins are used by the bootloader for programming take maybe two more minutes of work beyond the basic stuff. \$\endgroup\$ – old_timer May 17 '20 at 23:05

So depending on what your real goal is, it takes almost nothing to get the part to work. for about a buck a board at oshpark you can make a breakout board, the part, and header pins, done. power it from the pins and manipulate boot0 and reset (or power on) to put it into the bootloader mode then use the uart interface to program the part (simple protocol, the different stm32s use different features of the protocol but still easy to implement or probably find an existing tool).

With the f103 part you see:

To be compliant with the USB 2.0 full-speed electrical specification, the USBDP (D+) pin should be pulled up with a 1.5 kΩ resistor to a 3.0-to-3.6 V voltage range.

but say with the f024f part you see

No external termination series resistors are required on USB_DP (D+) and USB_DM (D-); the matching impedance is already included in the embedded driver.

I have not had issues with the usb connector (as silly as it is usb b connectors are cheap and easy to solder, waayy overkill but cheap and easy) D+/D- direct to the part and then an AP2112 to get 3.3 out of the 5V from the usb connector. Bare minimum that will work (plus headers to breakout the part), granted you may want a few more passive components.

With the f024 it supports dfu so using the boot0 pin you can put it in the bootloader and program via usb, no uart required.

For any of these parts you can use the swd interface to program them. The newer STM32G parts have some protection and are likely the future, virgin part you get one shot at a uart programming (start of app flash is erased). And with that program (or via swd) you can change the defaults so that boot0 works like it used to, but I suspect just like atmel (microchip) and the sam-ba bootloader being no more this may be no more and either usb or most likely swd being the only way in. So start to think of swd as being your primary choice over uart for stm32 parts. But depending on the part you can still rely on uart.

So you can toss the blue pill design if you want and do something more minimal, if you want to use the USB interface, then you need to add those resistors and if you want to power the board from the uart you need a 5V to 3.3V conversion solution.

Programming the part is in the documentation that you should have read before asking this question.

At startup, boot pins are used to select one of three boot options:
• Boot from User Flash
• Boot from System Memory
• Boot from embedded SRAM
The boot loader is located in System Memory. It is used to reprogram the Flash memory by using USART1. For further details please refer to AN2606.

And you can dig further to see which USART1 pins are used. Usually PA9/10. and PA13/14 for swd. There are little $5 not really jlink, jlink boards you can find various places search for something like stm32 jlink, little purple, usb-mini b and four pins on the other end for jumpers. The full sized nucleo boards as well as the discovery boards have stlink debuggers on one end which you can use if you remove two jumpers, cheaper that the usb dongle thing which I recommend against.

Can also just use a generic ftdi breakout board that supports mpsse, adafruit has one that is like $15, works great, unfortunately it only exposes one port so you cant do uart and swd, if you find a two or four port one (priced in that range or $5 or $10 more) then you can have uart and swd hooked up at the same time, for overall generic deveopment (uart more for debug than for programming the part).

Minimal non-production prototype you really need nothing to make the part work, power it externally (ftdi breakout board), etc. I usually put a reset and boot0 button with the appropriate pull up/down as needed. Plus an led or two with the appropriate resistor.

The stm32f103 appears to be a very popular part for ST to use on their nucleos and others as the debug end of the board, so you can examine those schematics as well to see what other passives they use for various reasons as you work toward a product.

If you are only using the stm32f103 because you have played with the blue pill, it is a bit of an old part at this point, they have, as mentioned, newer parts with newer features. And wow those are some seriously expensive parts, you can get other parts that do usb for a fraction of that price (from ST), if usb is a requirement.

i2c, spi, uart, etc. those are generally there, not seen an exception under the stm32 umbrella. There are pull ups on the I/O pins if you want additional/external for i2c or spi you can certainly add those, so far I have not "needed" external pull ups for i2c/spi to work.

I have not needed an external crystal/clock for dfu to to work (again not the stm32f103) I generally only use the uart for power and to program the part. You should be able to experiment with the blue pill to not use the external crystal if you end up using that part.

There are popular third party bootloaders as you probably know that you can do arduino like programming of the blue pill you will need either the uart interface or swd on a virgin part to load that firmware then if you dont erase that firmware as with on the blue pill, you can use the programming tools you are used to.

If you have already used the swd interface on the blue pill to program the flash then you are done that is all you need on your board when you make it...(well, plus a solution to pull the boot0 pin)

Be careful this can get pretty addictive, a buck a board or so for the pcb, and you can buy whatever (hand solderable) part you want on mouser/digikey/your_favorite and not be limited by what is available. Granted it takes some cash to get the equipment and stock of pins and passives and such, but in the long run that pays for itself...at the same time it is nice sometimes to just order a $10 board from amazon/mouser/st and plug it in and use it, drag and drop the binary no extra tools/boards...


You only need to use CubeMx to be sure there are no conflict with each I/O, so in CubeMX you just have to select the right MCU, and all options you need like Serial, SPI, I2C, clock etc, after that schematic is right away :

  • Handle correctly power supply with decoupling capacitor 100 nf (one ferrite bead is also good)
  • Connect BOOT0 to GND via 10 K
  • Add or not 32,768 Crystal for LSE clock and /or crystal for HSE clock (all option)
  • Connect correct wire to SWD interface (including reset line tied to Vcc by resistor)
  • connect all the other interface line Serial, Spi, I2C to your device.

nothing more you are done.


The Blue Pill (BP) uses two mpu lines as direct USB interface (PA11, PA12) .

There are numerous BP schematics on web eg vast numbers here

Here is an excellent BP discussion that is likely to be useful.

This SE EE Q&A How to program custom STM32F103 board discusses a cloning attempt.

This page discusses a BP superset that is liable to provide some useful ideas. Super Blue Pill — Like STM32 Blue Pill, But Better!. USB is still on PA11, PA12 - USB hardware consists of 3 resistors :-) !

Schematic of "Super Blue Pill"

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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