If you installed the latest STM32CubeIDE and could not find the pinout editor, this STM32CubeIDE 2.0 tutorial is for you. From version 2.0, ST took STM32CubeMX out of the IDE. You now configure the chip in one program and write code in another. It confuses almost every beginner, and most YouTube guides still show the old way. Below you will build a complete first project on a low-cost STM32F103C8 “Blue Pill”: blink the LED, print text over UART and step through the code with the debugger.

Table of Contents
What changed in STM32CubeIDE 2.0 (and why this STM32CubeIDE 2.0 tutorial is needed)
ST released STM32CubeIDE 2.0.0 in November 2025. In the release announcement, ST says device configuration is now only available in the stand-alone STM32CubeMX tool. You configure peripherals and generate code in CubeMX, then import the generated project into STM32CubeIDE to write, build and debug.
In practice this means:
- Two downloads, two installs. CubeIDE no longer ships with CubeMX inside it.
- The .ioc file opens in CubeMX. If CubeMX is installed, double-clicking the .ioc inside CubeIDE launches the stand-alone tool.
- Manual refresh after re-generating. ST confirmed the IDE does not yet refresh the file tree automatically after CubeMX re-generates code, so press F5 on the project.
- No login needed to use the IDE any more.
- Independent versions. You can keep an older CubeMX for an old project and a newer one for new chips.
The good news: the code you write is exactly the same HAL code as before. Only the workflow moved. The diagram below shows the full path you will follow.

What you need
| Item | Why | Notes |
|---|---|---|
| STM32F103C8 Blue Pill | Cheap, popular first STM32 board | Many boards carry clone chips (CKS32/CS32/APM32). They mostly work, but see the errors section. |
| ST-LINK V2 (or clone) | Programs and debugs over SWD | A Nucleo board’s on-board ST-LINK also works. |
| USB-TTL adapter (3.3 V) | Shows UART text on your PC | CP2102 or CH340 with 3.3 V logic. |
| Jumper wires | SWD + UART | Keep SWD wires under 20 cm. |
| PC with Windows/Linux/macOS | Runs CubeMX and CubeIDE | About 3 GB free disk for both tools and firmware packs. |
Not sure your board is genuine? Read our guide on spotting fake electronic components before you start. And if you are wondering why we use STM32 at all, see why STM32 is my first choice for advanced embedded systems.

Step 1: Install STM32CubeMX and STM32CubeIDE
- Download STM32CubeMX from the official ST CubeMX page and install it.
- Download STM32CubeIDE 2.x from the official ST CubeIDE page and install it. Accept the ST-LINK driver install on Windows.
- Open CubeMX once and let it download the STM32CubeF1 firmware package (Help → Manage embedded software packages). Do this on a good connection; the pack is a few hundred MB.
- Make Windows open
.iocfiles with CubeMX, not an old CubeIDE 1.x. ST recommends this to avoid conflicts if you still have 1.x installed.
Step 2: Configure the Blue Pill in CubeMX
Start a new project: File → New Project, type STM32F103C8 in the part number box, select STM32F103C8Tx and click Start Project. Then set these four things. Do not skip the first one.
2.1 System Core → SYS → Debug: Serial Wire
This keeps PA13/PA14 as the SWD debug pins. If you leave Debug as No Debug, your next flash disables SWD and the ST-LINK can no longer connect. It is the most common beginner mistake on STM32.
2.2 System Core → RCC → HSE: Crystal/Ceramic Resonator
The Blue Pill has an 8 MHz crystal. Enabling HSE lets you run the core at the full 72 MHz.
2.3 Clock Configuration: 72 MHz
Open the Clock Configuration tab. Select HSE as the PLL source, PLLMUL ×9 and the PLLCLK as the system clock. Type 72 in HCLK and press Enter. CubeMX sets APB1 to /2 (36 MHz maximum) and the flash wait states for you.
2.4 Pins and peripherals
- Click PC13 → GPIO_Output. Give it the user label
LED. The on-board LED is active-low: writing 0 turns it on. - Connectivity → USART1 → Mode: Asynchronous. Leave 115200 baud, 8 data bits, no parity, 1 stop bit. CubeMX assigns PA9 (TX) and PA10 (RX).
2.5 Project Manager: choose STM32CubeIDE and generate
In Project Manager, enter a project name (no spaces), choose a folder, and set Toolchain / IDE: STM32CubeIDE. Under Code Generator, tick Generate peripheral initialization as a pair of .c/.h files. It keeps main.c tidy. Click GENERATE CODE.
Step 3: Import the project into STM32CubeIDE 2.0 and write the code
Open STM32CubeIDE, choose a workspace, then File → Import → General → Existing Projects into Workspace. Browse to the folder CubeMX created and click Finish. Open Core/Src/main.c. Only write inside the /* USER CODE BEGIN */ … /* USER CODE END */ pairs. CubeMX keeps those blocks when it re-generates and overwrites everything else.
Add the includes near the top:
/* USER CODE BEGIN Includes */
#include <stdio.h>
/* USER CODE END Includes */
Declare a buffer and counter before the main loop:
/* USER CODE BEGIN 2 */
char msg[48];
uint32_t count = 0;
/* USER CODE END 2 */
Then put the blink-and-print code inside the loop, in the USER CODE BEGIN 3 block (CubeMX places it inside while (1)):
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin); /* PC13, active-low */
int len = snprintf(msg, sizeof msg, "Hello from STM32! count=%lu\r\n", count++);
if (len > 0)
{
HAL_UART_Transmit(&huart1, (uint8_t *)msg, (uint16_t)len, 100); /* 100 ms timeout */
}
HAL_Delay(500);
}
/* USER CODE END 3 */
LED_GPIO_Port and LED_Pin come from the user label you set in CubeMX. They are defined in main.h. HAL_UART_Transmit blocks until the bytes are sent or the timeout expires. That is fine for a first project. In a real product you would use DMA or interrupts so the CPU is not waiting on the UART.
Changed something in CubeMX later? Re-open the .ioc, click GENERATE CODE again, then in CubeIDE right-click the project and press Refresh (F5) before building.
Step 4: Build, flash and debug
- Build: Project → Build Project (Ctrl+B). The console should end with Build Finished. 0 errors and show the flash/RAM use. This blink program uses only a few KB of the 64 KB flash.
- Run: Click the green Run button. The first time, accept the default debug configuration (ST-LINK GDB server, SWD). The LED starts blinking at 1 Hz.
- See the UART text: Open a serial terminal (PuTTY, Tera Term or the CubeIDE terminal) on the USB-TTL COM port at 115200 baud. You should see
Hello from STM32! count=0, 1, 2… - Debug: Click the bug icon. Set a breakpoint on the
HAL_GPIO_TogglePinline by double-clicking the left margin, then press F8 (Resume) and watch it stop. Hover overcountto see its value.
Next steps: add a display with our 16×2 LCD with STM32 guide, or put your STM32 online with ESP8266 and STM32.
Common errors and fixes
| Error / symptom | Likely cause | Fix |
|---|---|---|
| No ST-LINK detected | Driver missing or bad USB cable/port | Re-install the ST-LINK driver from the CubeIDE folder; try another USB port; update the ST-LINK firmware in STM32CubeProgrammer. |
| Target not found / cannot connect | SWD disabled by a previous program (Debug was not set to Serial Wire) | Use Connect under reset in the debug settings and hold the board’s RESET button while you click Run, then release. Or set BOOT0=1, power-cycle, erase the chip, set BOOT0=0. |
| Could not verify ST device | Clone MCU (CKS32/CS32) with a different ID code | Use a genuine STM32 for learning, or change the debugger to OpenOCD and adjust the expected ID. Many clones work but are a time sink. |
| Nothing on the serial terminal | TX/RX swapped, wrong COM port or baud | Adapter TX → PA10, adapter RX ← PA9, common GND, 115200 baud. |
| My code disappeared after re-generating | Code written outside USER CODE blocks | Move it inside the BEGIN/END pairs. CubeMX only keeps those. |
| New .ioc settings not in the build | IDE did not refresh after generation | Right-click the project → Refresh (F5), then build again. |
For hardware faults (dead board, no 3.3 V, hot regulator), follow our step-by-step method for troubleshooting a dead circuit board.
Frequently asked questions
Can I still use STM32CubeIDE 1.x?
Yes. ST keeps older versions available for download, and existing 1.x projects keep working. For new projects, it is worth learning the 2.0 workflow now, because new chips will be supported there.
Do I have to use CubeMX at all?
No. You can write register-level code or use the LL drivers without generating anything. But for beginners, CubeMX saves hours of clock and pin configuration and prevents mistakes like disabling SWD.
Is the Blue Pill still a good board in 2026?
It is fine for learning because it is cheap and well documented, but clone chips are common. For serious projects, a Nucleo board or a Black Pill (STM32F401/F411) with a genuine chip and a built-in debugger is easier.
Why is my LED on when I write GPIO_PIN_RESET?
On the Blue Pill the LED is connected between 3.3 V and PC13, so a low pin turns it on. This is called active-low and is very common on dev boards.
Can I use VS Code instead?
Yes. CubeMX can also generate CMake or Makefile projects, and ST’s VS Code extension supports STM32. The CubeMX steps in this tutorial stay the same.
Conclusion
STM32CubeIDE 2.0 only adds one extra step: configure and generate in CubeMX, then import, build and debug in the IDE. Set Debug to Serial Wire, write code only inside the USER CODE blocks, and press F5 after every re-generation. Do those three things and the new workflow is as fast as the old one. When your circuit works, turn it into a real board with our KiCad 10 to JLCPCB ordering guide. Your next steps are timers, interrupts and DMA. That is where STM32 really beats Arduino-class boards.
Need STM32 firmware, a custom STM32 PCB or help with your final-year project? We design custom PCBs, firmware and complete working prototypes for students and companies. Message us on WhatsApp or use the contact form. You can write in Bangla or English.
0 Comments