stm32 projects

STM32CubeIDE: Downloading, Installation and Onboard led Testing


STM32CubeIDE is a robust Integrated Development Environment (IDE) designed by STMicroelectronics specifically for STM32 microcontrollers. It provides a comprehensive toolset and features to facilitate the development and programming of STM32-based applications. In this detailed guide, we will walk you through the entire process of downloading, installing, and performing an onboard LED blink test using STM32CubeIDE. By following these steps, you will be well-equipped to begin your journey in STM32 development.

Amazon Links:

STM32 Blue Pill

ST-Link V2

Jumper wires


Usb cable

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

STM32 Blue Pill Board PinOut:


The STM32 “Blue Pill” board is a popular development board based on the STM32F103C8T6 microcontroller from STMicroelectronics. It is widely used by hobbyists and enthusiasts for prototyping and learning purposes due to its low cost and rich features. Let’s take a closer look at the STM32 Blue Pill board and its pinouts:

Power Pins:

3.3V:This pin provides a regulated 3.3V power supply for the microcontroller and other components on the board.

5V: This pin allows you to supply an external 5V power source to the board. It is typically used when the board requires more power than can be provided by USB.

Ground Pins:

These pins are the ground connections for the board.

GPIO (General-Purpose Input/Output) Pins:

The STM32 Blue Pill board features a total of 37 GPIO pins (numbered as PB0 to PB15, PC13 to PC15, and PA0 to PA7). These pins can be used as either inputs or outputs and can interface with various external devices or components.

Analog Pins:

The STM32 Blue Pill board provides 10 analog input pins labeled as PA0 to PA7 and PB0 to PB1. These pins are connected to the built-in analog-to-digital converter (ADC) of the microcontroller and can be used to measure analog signals.

Serial Communication Pins:


The STM32 Blue Pill board has USART1 pins (PA9 and PA10) that can be used for asynchronous serial communication.


This board also includes USART2 pins (PA2 and PA3) for additional asynchronous serial communication.

SPI Pins:

The board offers SPI communication with SPI1 pins (PA5, PA6, and PA7) and SPI2 pins (PB13, PB14, and PB15).

I2C Pins: The board supports I2C communication with I2C1 pins (PB6 and PB7).

PWM (Pulse Width Modulation) Pins:

The STM32 Blue Pill board has multiple pins that can generate PWM signals. These pins are labeled with a ‘~’ symbol and are capable of producing analog-like output signals with varying duty cycles.

External Interrupt Pins:

The board provides external interrupt pins on various GPIOs. These pins can be used to trigger an interrupt in response to a change in their state.


The STM32 Blue Pill board has SWD (Serial Wire Debug) pins that allow you to connect a debugger or programmer for flashing the microcontroller’s firmware or performing debugging operations.

It’s important to note that the Blue Pill board’s pinout can be slightly different based on the specific manufacturer or version. Therefore, it’s always a good idea to refer to the board’s documentation or pinout diagram to ensure accurate pin configuration.

About ST-Link V2:


The ST-Link V2 is a commonly used programmer and debugger tool for STM32 microcontrollers. It is designed to work seamlessly with the STM32CubeIDE, which an integrated development environment (IDE) is provided by STMicroelectronics for STM32 microcontroller development. Here’s an overview of the ST-Link V2 and its features:

Programmer and Debugger: The ST-Link V2 allows you to program the firmware onto STM32 microcontrollers and also provides debugging capabilities. It connects to the microcontroller’s SWD (Serial Wire Debug) interface for programming and debugging operations.

SWD Interface: The ST-Link V2 uses the Serial Wire Debug (SWD) interface to communicate with STM32 microcontrollers. The SWD interface consists of two pins: SWDIO (Serial Wire Debug I/O) and SWCLK (Serial Wire Clock). These pins are used for bi-directional communication and control between the ST-Link and the microcontroller.

JTAG Support: In addition to SWD, the ST-Link V2 also supports JTAG (Joint Test Action Group) interface, which provides an alternative debugging method for STM32 microcontrollers that have JTAG capability.

USB Connection: The ST-Link V2 connects to the host computer through a USB interface. It provides power to the target STM32 microcontroller and allows data transfer between the host computer and the microcontroller.

Debugging Capabilities: The ST-Link V2 supports various debugging features, including breakpoints, step-by-step execution, watchpoints, and real-time variable inspection. These features greatly assist in the software development and debugging process.

Firmware Upgrade: The ST-Link V2 can be updated with the latest firmware provided by STMicroelectronics. Firmware updates typically add new features, improve compatibility, and fix any known issues or bugs.

Compatibility: The ST-Link V2 is compatible with a wide range of STM32 microcontrollers. It is specifically designed to work with the STM32CubeIDE, which is an official development tool from STMicroelectronics.

Standalone Mode: The ST-Link V2 can also be used in standalone mode, allowing you to use it as a programmer without relying on an IDE. In standalone mode, you can use various software tools like STM32CubeProgrammer or ST-LINK Utility to program the microcontroller.

Additional Features: The ST-Link V2 also provides features like power measurement, which allows you to monitor the power consumption of the target microcontroller during runtime.

When using the ST-Link V2 with the STM32CubeIDE, you can easily configure the debugging settings and perform operations such as flash programming, debugging sessions, and real-time debugging.

Overall, the ST-Link V2 is a powerful and versatile tool for programming and debugging STM32 microcontrollers. It provides seamless integration with the STM32CubeIDE and offers a range of features to support efficient software development and debugging.

About STM32CubeIDE:

STM32CubeIDE is a robust and feature-rich integrated development environment (IDE) designed by STMicroelectronics for developing applications targeting STM32 microcontrollers. With its powerful combination of Eclipse-based tools and STM32Cube software libraries, STM32CubeIDE offers developers an efficient and user-friendly environment to streamline the entire development process and how it simplifies STM32 microcontroller development.

A Unified Development Platform: At the core of STM32CubeIDE is the Eclipse platform, a widely adopted and highly customizable IDE. By leveraging Eclipse’s flexibility and extensibility, STM32CubeIDE provides a familiar and robust development environment for software engineers.

Seamless Integration with STM32Cube Software Libraries: STM32CubeIDE seamlessly integrates with the STM32Cube software libraries, which are comprehensive sets of peripheral drivers, middleware components, and ready-to-use examples. These libraries simplify the configuration and utilization of STM32 microcontroller features, allowing developers to focus on application-specific logic.

Graphical Configuration with STM32CubeMX: STM32CubeIDE incorporates STM32CubeMX, a graphical configuration tool that simplifies the initial setup of STM32 microcontrollers. With CubeMX, developers can easily configure pin assignments, clock settings, and peripheral configurations through an intuitive user interface. CubeMX generates initialization code that can be directly imported into STM32CubeIDE, saving valuable development time.

Rich Code Development Features: STM32CubeIDE provides a powerful code editor with features such as syntax highlighting, code completion, and intelligent code navigation. The integrated code generator allows developers to quickly generate initialization code for peripherals, reducing the time spent on manual configurations. The IDE supports both C and C++ programming languages, enabling developers to write efficient and modular code.

Advanced Debugging Capabilities: Debugging is a critical aspect of microcontroller development, and STM32CubeIDE offers advanced debugging features to expedite the process. It supports breakpoints, step-by-step execution, real-time variable monitoring, and peripheral register inspection, providing developers with deep insights into their code’s behavior. The seamless integration with ST-Link hardware enables reliable and efficient programming and debugging of STM32 microcontrollers.

Project Management Made Easy: STM32CubeIDE simplifies project management with its intuitive interface. Developers can easily create, organize, and manage multiple projects within a single workspace. The IDE supports version control systems like Git, enabling collaborative development and easy tracking of code changes.

Cross-Platform Support: STM32CubeIDE caters to the diverse needs of developers by providing support for Windows, Linux, and macOS operating systems. It ensures that developers can work on their preferred platform while enjoying the same powerful features and functionalities.

Regular Updates and Support: STMicroelectronics demonstrates a commitment to enhancing STM32CubeIDE by regularly releasing updates that include bug fixes, performance improvements, and support for new STM32 microcontroller devices. The extensive documentation, tutorials, and application notes provided by STMicroelectronics assist developers in utilizing the full potential of STM32CubeIDE. Furthermore, a thriving community of STM32 developers contributes to online forums, providing support and sharing knowledge.

STM32CubeIDE Downloading:

To acquire STM32CubeIDE, follow these steps:

Visit the official STMicroelectronics website


Once the website is loaded, navigate to the “STM32 Developer Zone” menu.

Within the menu, locate and click on the option labeled “STM32CubeIDE.”


On the STM32CubeIDE page, find the section titled “Download STM32CubeIDE.”


Within this section, select the you operating system in my case I select the windows. click on the provided download link to initiate the download process.


Creating an Account: Before proceeding with the installation, you need to create an account:

After clicking the download link, you will be redirected to the STMicroelectronics creating Login/Register page .


On the website, search for the “Create Account” option and click on it.


Fill in the necessary details to register for a new account.

Once completed, submit the registration form.

You will receive a validation email at the provided email address.

Access your email inbox and click on the validation link to confirm your account.


After clicking the validate now button, you will be redirected to the STMicroelectronics complete your registration page. Choose the password.


After choosing the password it will show you the message” the registration has been completed”, so click on login here.


After clicking the login here button you will be redirected to the STMicroelectronics already registered page.

Now that your account is validated, you can proceed with downloading STM32CubeIDE:

Return to the STMicroelectronics website.

Log in using the credentials you created during the account registration process.


Locate the download button associated with STM32CubeIDE and click on it.


This will initiate the download of the STM32CubeIDE installation package.


Depending on your internet connection speed, the download process may take some time.

STM32CubeIDE Installation:

Once the download is complete, you can proceed with the installation of STM32CubeIDE:

Locate the downloaded file, typically in your computer’s default downloads folder.

Extract the contents of the downloaded file to a convenient location on your computer.


After extraction, navigate to the extracted folder and locate the installer file.

Double-click on the installer file to initiate the installation process.


Follow the on-screen instructions to proceed with the installation.

Select the desired installation location for STM32CubeIDE on your computer.


During the installation process, you may encounter a popup dialog regarding the installation of STMicroelectronics Universal Serial Bus (USB) drivers. If prompted, install these drivers.


Once the installation process is complete, click the “Next” button.


Then click “Finish” button to finalize the installation.


Launching STM32CubeIDE:

Now that you have successfully installed STM32CubeIDE, it’s time to launch the IDE:

Locate the STM32CubeIDE icon on your desktop or navigate to the installation location you selected in the previous step.

Double-click on the STM32CubeIDE icon to launch the application.



Upon launching, you will be prompted to select a workspace where your projects will be saved.


Choose a suitable location for your workspace and click the “Launch” button.

STM32CubeIDE will now load and display the welcome screen, indicating that the IDE has been successfully launched.


Creating New STM32 Project and Test Led Blink:

Before starting a new STM32 project, it is important to ensure that the STM32 microcontroller is properly connected to the ST-Link V2. Below is the circuit diagram for reference:


In the circuit, I connected the SWDIO pin of the STM32 to the SWDIO pin of the ST-Link V2. Similarly, connect the GND pin of the STM32 to the GND pin of the ST-Link V2. The SWCLK pin of the STM32 should be connected to the SWCLK pin of the ST-Link V2. Finally, connect the 3.3V pin of the STM32 to the 3.3V pin of the ST-Link V2 for power supply.

Ensuring the correct connections between the STM32 and ST-Link V2 is crucial for successful programming and debugging of the STM32 microcontroller. Once the connections are established, connect the ST-Link v2 with you system.

Before starting a new project, it is important to connect the ST-Link V2 to your computer system. Ensure that the ST-Link V2 is properly connected via USB to your computer.

To open a new project in STM32CubeIDE, follow these steps:

Click on “File” in the menu bar. Select “New” and then click on “STM32 Project”.


After clicking on “STM32 Project”, STM32CubeIDE may take a moment to load and download the necessary libraries. Please be patient during this process as it may take some time depending on your internet connection speed.


After the necessary libraries are downloaded and installed, STM32CubeIDE will open a “Target Selection” window. In this window, you can search for your specific STM32 microcontroller part. In my case I am using the STM32F103C8T6 microcontroller, I search for it in the “Part Number” field.

In the “Target Selection” window, locate the “Part Number” field.

Type “STM32F103C8T6” in the search field.


Select the appropriate option for your microcontroller, in my case, I am using the stm32 blue pill “STM32F103C8T6”.

Once selected, click the “Next” button to proceed.

After selecting the microcontroller part, you will be prompted to provide additional information and settings for your project In the “Project Name” field, enter a suitable name for your project. Select the desired options for the “Targeted Language” based on your preference or project requirements. Choose the appropriate “Binary Type” based on your project needs (e.g., executable, library). Select the “Project Type” that best suits your project. Once you have made these selections, click the “Finish” button to create your project.


By providing these details and clicking the “Finish” button, STM32CubeIDE will generate your project with the specified settings, allowing you to start coding and developing for your STM32 microcontroller.


In the STM32CubeIDE “Pinout & Configuration” window, click on the “System Core” tab.

Under the “System Core” tab, locate the “SYS” and click on it.

In the “System Mode and Configuration” section, locate the “Debug mode” option.

Select “Serial Wire” as the debug mode from the available options.


By selecting “Serial Wire” as the debug mode, you enable the Serial Wire Debug (SWD) interface for debugging and programming your STM32 microcontroller.

Configuring GPIO Pin for LED Control:

We will now select the appropriate GPIO pin for controlling the onboard LED. For this example, we will use PC13:

Right click on the specified GPIO pin and select as GPIO_Output to enable them as output pin for LED control.


Now save the project


When you click the “Save” button, an alert window will appear asking, “Do you want to generate code?” click the “Yes” button.


Again click yes button


By clicking “Yes”  button STM32CubeIDE will generate the necessary code based on your pin configuration and open the associated perspective. This perspective provides you with the appropriate tools and views for further development and customization of your project. So wait for it for a while


Your code will look like this


Now paste the below code into while section


STM32 Project Build and Run:

Click the “Build” icon in the toolbar or menu of STM32CubeIDE. It is usually represented by a hammer or a similar symbol.


After Clicking on the “Build” icon to initiate the build process.

Once the build process starts, the CDT (C/C++ Development Tools) Build Console will display messages related to the build progress and any errors or warnings encountered. These messages provide information about the build status and help identify any issues that need to be addressed.

Please note that the specific message displayed in the CDT Build Console may vary depending on the project and any errors or warnings encountered during the build process. It is important to carefully review these messages to identify and resolve any issues before proceeding further with your project.


To run this STM32 project, click on the “Run” button on the toolbar.


After clicking, an “Edit Configuration” window will open. In this window, click on the “Debugger” option. In the “Debugger” section, select “ST-Link (OpenOCD)” as the debug probe.


Then, click on the “Show Generator Options” button.


In the “Generator Options” section, click on “Reset Mode” and select “Software System Reset”.


Click the “Apply” button to apply the changes.


After clicking the “Apply” button, click the “OK” button.


If there are no errors in the program, this message will be printed on the console.”


Then unplug the ST-link v2, and plug again.

Complete program:

Practical Demonstration:

As you can see, I have connected an STM32 microcontroller to an ST-Link V2 using female-to-female wires.



Watch Video:

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button