“I’m not here to teach you how to blink an LED. I’m here to help you not get overwhelmed before you even start.”

Welcome to the world of STM32 a family of powerful microcontrollers found in everything from DIY gadgets to satellites. It’s exciting stuff… until you open a datasheet and realize it’s 3300 pages long and full of terms like “NVIC priority grouping” and “AXI Interconnect matrix”. Not sure? here take a look the STM32H743 Manuals. Take a deep breath. You don’t need to learn it all, not yet.

This guide isn’t another LED-blink tutorial. I’ll walk you through what actually matters at the beginning, the tools, the flashing methods, the learning path, and just as importantly, what you can safely ignore (for now).

Whether you’re coming from Arduino, Raspberry Pi, or just curious about embedded systems, this post will help you start your STM32 journey with fewer headaches and more “aha!” moments.

Let’s dive in step by step, no panic required.

Step 1: Get the Right STM32 Board

get yourself an STM32 development board. There are many out there, but as a beginner, you want something easy to find, affordable, and well supported.

If you’re in Indonesia (like me), you’ll easily find:

  • STM32F103 (aka “Blue Pill”)
  • STM32F401 / F411 (Black Pill or Nucleo boards)

Here’s how they differ:

  • F1 series = Cortex-M3 core
  • F4 series = Cortex-M4 core (with more features)

Go for F4. Trust me. More features, better performance, still cheap, and far more satisfying to work with once you start playing with ADCs, DMA, and floating-point math.

Step 2: Get Yourself Your Future Lifesaver

Let’s talk about the one tool that’s going to save you, maybe not today, maybe not tomorrow, but someday when your STM32 board mysteriously stops responding and mocks you with silence. That tool is called the ST-Link.

ST-Link

ST-Link is a small programmer/debugger from STMicroelectronics. It talks directly to your STM32 chip using the SWD interface, like a private backdoor into the MCU’s memory and debug system. It lets you:

  • Flash firmware (even when the bootloader is dead)
  • Debug with breakpoints and watch variables
  • Unbrick your board when nothing else works

Tools That Use ST-Link

There are a few official tools that talk to your ST-Link:

  1. STM32 ST-Link Utility (Old Tool)
    This is the classic software. It’s basic, stable, and works well for flashing .hex or .bin files. It’s mostly retired, but still handy.
  2. STM32CubeProgrammer (New Tool)
    This is ST’s modern, all-in-one tool for flashing and memory access. It replaces the old utility and works with nearly all STM32 chips and tools.

About the Clones

Let’s be honest, even if you paid a normal, standard price for your ST-Link (not some crazy cheap deal)… There’s still a decent chance it’s a clone. Clones are still useful, especially if you’re just starting out. They usually:

  • ✅ Work with the old ST-Link Utility
  • ✅ Flash .hex or .bin files just fine
  • ✅ Install bootloaders without issue
  • ❌ Don’t work with CubeIDE or STM32CubeProgrammer
  • ❌ Can’t be used for debugging due to missing or invalid serial

I’ve used them. They work.
I just don’t want you wasting an entire evening trying to figure out why it’s not working “like in the YouTube video”

Buying a Real One? Here’s the Smart Move:

Since buying an ST-Link in random online marketplace is like playing lottery, it’s not about how much you pay, it’s where and how you buy it. The smart move:

  • Ask a friend who has a working one.
    If theirs works with CubeIDE, buy from the same shop.
  • Buy a Nucleo board.
    It comes with a guaranteed original ST-Link built in.

Step 3: Choosing an IDE

I won’t cover low-level command-line setups here, those are great, but let’s not start with brain surgery on day one. Here’s the good news: you have two solid paths as a beginner.

Arduino IDE – The Easy Way In

Yep, you read that right, STM32 works with the Arduino IDE. And honestly, this is how many of us stumbled into the STM32 world in the first place (me). Everything feels familiar. No complex setup. No cryptic IDEs. Just digitalWrite(), Serial.print(), and off you go. It’s the easiest way to get started, especially if you’re coming from regular Arduino boards like the Uno, Nano, or ESP32.

There are tons of tutorials out there, but here’s the important thing to look for: Make sure the tutorial shows you how to install the latest STM32 package from Arduino_Core_STM32 not some outdated fork or unofficial hack.

If your board doesn’t come with a USB bootloader, don’t worry, you can flash one manually. I even made one for STM32F4 boards (STM32F4XX_HID_Bootloader). It lets you upload code directly over USB without needing serial adapters or ST-Link every time.

If you’re just testing the waters, building small projects, or transitioning from Arduino, this setup is more than enough.

But… At some point, blinking LEDs won’t be enough.

You’ll want to:

  • Use DMA with ADCs precisely
  • Configure RTCs, I2C, SPI, USARTs with advanced control

That’s where another IDE comes in.

STM32CubeIDE – When You’re Ready to Level Up

CubeIDE is ST’s official, all-in-one development platform:

  • Based on Eclipse (yes, it’s a bit heavy, but powerful)
  • Includes code editor, compiler, debugger, and CubeMX (the config tool)
  • Fully integrated with ST-Link
  • Supports all STM32 chips natively
  • Lets you generate code from a GUI, not just guess register bits

And the best part? It’s free. CubeIDE can feel intimidating at first, but once you understand how the project structure works, it’s a beast, in a good way.

Want precise control over your peripherals?
Want to debug like a pro?
Want to build real firmware, not just hobby sketches?

Then CubeIDE is where you want to go.

Step 4: Flashing

You’ve written some beautiful C code (or at least something that compiles). Now you need to send it to the STM32 so it actually does something. That process is called flashing, upload or download your code into the microcontroller’s memory. Wait what? upload or download? Let me clear it up:

  • From your computer’s perspective, you’re uploading data to the board.
  • From the MCU’s perspective, it’s downloading data from your computer.

In STM32 documentation (and many IDEs like CubeIDE), they tend to use the word download because everything is centered around the MCU’s perspective.

So, don’t get confused. Whether the button says Upload, Download, or Flash, it all means the same thing: Put this firmware into the chip so it can start running your masterpiece.

But before we dive into how to flash, we need to talk about what makes flashing possible in the first place

The Bootloader, and Why Should You Care?

A bootloader is a small program that runs immediately when your STM32 powers on. Its job is to decide what to do next:

  • Should it jump into your user application (your code)?
  • Or should it wait and listen for new firmware over USB, UART, or some other method?

Think of it as the microcontroller’s front desk receptionist. “Good morning! Do you want to go straight to the main party (your firmware), or should we hold the door for a flashy new update?”

Some STM32 chips have a built-in bootloader (stored in ROM, so you can’t erase it) that allows flashing via UART or DFU, even if your main firmware is broken. Other boards use a custom bootloader that you install yourself, usually to add features like USB upload or to mimic the Arduino experience. In both cases, the bootloader is what allows a new firmware to be received from the outside world.

Common Flashing Methods for STM32

Alright, let’s break down the most common ways to flash your STM32. No walkthroughs here, just a deep understanding of each one so you know what’s actually happening under the hood.

ST-Link (Hardware Debug Interface)

This is the gold standard. ST-Link is ST’s official debugger/programmer tool. When you use this, you bypass the bootloader completely. Instead, ST-Link connects directly to the SWD (Serial Wire Debug) interface two wires (SWDIO and SWCLK) that let you directly read/write memory and flash. This is what pros and IDEs like CubeIDE use. It’s:

  • Boot-pins agnostic (doesn’t care about BOOT0)
  • Doesn’t require a USB or serial interface to work
  • Can also debug, not just flash

If you own an ST-Link (and you should), this is the go-to method for development. It’s fast, stable, works even if the board is “bricked”. If ST-Link is connected, you always have control. That’s why we call it a life save at first. All you need is of course the ST-Link.

UART (Serial Bootloader Mode)

This is the most universally supported flashing method across all STM32 chips. The built-in bootloader on STM32s always supports flashing over UART. Just connect to the TX and RX pins of your MCU, use a USB-to-Serial adapter, and tools like STM32CubeProgrammer or Flash Loader Demonstrator can handle the rest. It’s not the fastest, but it’s reliable, especially when everything else fails. All you need is USB to Serial Converter.

DFU (Device Firmware Upgrade)

DFU is a USB-based flashing method supported by many STM32s especially the F1 and F4 families. You can plug your board into USB, put it into bootloader mode (usually by pulling BOOT0 high), and flash it over USB no programmer needed. It’s clean, fast, and uses just a USB cable.

Custom USB Bootloader

Everyone’s Favorite… Until It Breaks. This is the “Arduino-style” flashing method used on many community boards. You flash a custom bootloader once via ST-Link, UART, or DFU. After that, you can upload code via USB, just like a normal Arduino. This is how STM32 boards act like Arduinos.

This method depends on the bootloader already being there (it’s not in the ROM, but part of flash memory). If you accidentally overwrite or corrupt it, you’ll need to fall back to ST-Link ,UART, or DFU to fix it. Still, when it works, it’s super convenient, especially for hobbyists and beginner-friendly workflows using Arduino IDE or PlatformIO.

Bonus Tip: Know Your Escape Plan

No matter which method you choose, you’ll eventually mess something up, overwrite your bootloader, break the clock tree, lose USB… That’s why: ST-Link is not optional. It’s your emergency key, your last resort, your embedded parachute.

Final Words

By now, you’ve seen the path, not just how to blink an LED, but what actually matters when you’re getting into STM32. Let’s recap the essentials:

  • STM32 board – Choose F4, much comunity support.
  • ST-Link – your life saver, even a clone is better than nothing.
  • Arduino IDE – if you want a fast, familiar, easy start.
  • STM32CubeIDE – when you’re ready for deeper control.
  • STM32CubeProgrammer – newest all-in-one tool for flashing
  • ST-Link Utility – the classic flashing software, works with clone.
  • Bootloader – a small program that runs immediately after power on.
  • ST-Link – your most reliable way to flash and debug.
  • UART Bootloader – built into most chips, great backup plan.
  • DFU – built-in USB bootloader.
  • Custom USB Bootloaders – Arduino-style uploads with some extra setup.

STM32 isn’t a weekend toy.

It’s a professional-grade platform that happens to be beginner-accessible. You just need to take that next step and then the next.

Got stuck? Want to see a specific topic covered?
Leave a comment, or message me, I’ve probably been stuck in the same place before.

Thanks for reading.
Happy hacking, and may your bootloader never vanish again.

Categorized in:

Tutorials,