Mastering STM32CubeIDE: a Step-by-Step Guide to Activating the On-Board LED of the STM32 Black Pill

by Tejvinder Singh in Circuits > Microcontrollers

99 Views, 2 Favorites, 0 Comments

Mastering STM32CubeIDE: a Step-by-Step Guide to Activating the On-Board LED of the STM32 Black Pill

17.jpg
1.jpg

Hi! This is the beginner-friendly technical tutorial on STM32CubeIDE which helps with the controlling over the LED attached to the STM32 Black Pill microcontroller. The guide has undergone rigorous development to create an insightful yet straightforward waking tutorial that can lead professionals to a thorough understanding of the STM32 Black Pill's STM32CubeIDE workflow with regard to both the functionality and the flexibility of the STM32CubeIDE. Guiding you through about the key aspects of embedded programming, you are able to know how to set up the development environment and Black Pill's hardware details, and write an eyes-catching code to control our LED. This starting activity, which is the fundament of working with embedded systems, not only helps with fundamental proficiency but is an essential first step for projects that go beyond. Members can enjoy the power of microcontroller programming knowledge as it covers the issue called precision as well as the issue governed by the principles of professionalism.

Supplies

2.jpg

To commence with the embedded programming, the following equipment and software installations are essential:To commence with the embedded programming, the following equipment and software installations are essential:



1. An STM32CubeIDE or STM32CubeProgrammer running on any pc or laptop depending on the model engineer is using.



2. STM32 Black Pill development board with the pinout feature.



3. A compatible USB cable to aid with the connection and programming.



Please remember that you will need the aforementioned prerequisites before you start the tutorial in order for us smooth learning process.

Making a New Project File in STM32CubeIDE

GOTO->> File>New>STM32 Project

Downloads

ADD Configurations for Your STM Board

Search For Component- STM32F401CEY6TR click on "Next"

Downloads

Configuring Your Board

Configure Your Board As Shown

Downloads

Configure Your Clock

Downloads

Open Main.c File

GOTO Project and find main.c file

Downloads

Goto While(1) in Main() and Add Your Code

I use GPIO Pin 13 you may use other GPIO Pins


HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 1);

HAL_Delay(500);

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 0);

HAL_Delay(500);

Downloads

Debug

Open and Click On Debug(1)

Downloads

Copy Path of .elf File Generated

Right click on Project and click on show in system explorer and copy the path

Downloads

Open STMCubeProgrammer and Connect to STM Board Via USB

Downloads

Click on Open File and Paste the Copied Path

Downloads

Go to Download Options (Found in Toolbar on the Left)

Downloads

Change Download Options and Click on "Start Automatic Mode"

Downloads

The Final Step

16.png

The LED starts blinking