Introduction: STM32CubeIDE:a Step by Step Guidance to Activate the On-Board LED of STM32 Black Pill

Welcome to our comprehensive tutorial on utilizing STM32CubeIDE to control the built-in LED of the STM32 Black Pill microcontroller. This meticulously crafted guide is aimed at professionals seeking a clear and concise walkthrough, enabling them to harness the full potential of the Black Pill and showcasing the versatility of STM32CubeIDE. Throughout this tutorial, we will delve into the key aspects of embedded development, including environment configuration, understanding the hardware specifics of the Black Pill, and writing efficient code to manage the LED. This foundational exercise not only cultivates expertise in embedded systems but also establishes a solid foundation for tackling more intricate projects. Come join us as we shed light on the principles of microcontroller programming with utmost precision and professionalism.

Supplies

  1. STM32 Black Pill
  2. STMCubeIDE
  3. STMCubeProgrammer
  4. USB C Cable

Step 1: Make a New Project File in STM32CubeIDE

Go to files>New>STM32 Project>>Nme the project

Step 2: Add the Configurations for Your STM Board

Enter the Commercial Part Number :STM32F401CCU6>Select the required and then click on"Next".

Step 3: Configuring the Board Settings

the slide will open with STM32 >select the pin (13 as GPIO_output)>>then set the oher settings (RCC Mode configuration>>high speed clock to cereamic/crystal response.

Step 4: Configure the Clock

click on clock configuration and select the HSE in source MUX and system MUX.then Click on resolve clock issues.

Step 5: Settings

Right click and the dailouge box appears choose settings from C/C++Build>>select MCU Post Build output and select the options shown in the picture.

This will appear on the left hand side of the screen.


Step 6: Main.c

project>>core>>src>>main.c

Step 7: Write the Code

Write the code in while loop or static void

I used 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);

or

HAL_TogglePin(GPIOC, GPIO_PIN_13);

HAL_Delay(500);

Step 8: Debug

Debug the file.

Step 9: Copy the Path Of.elf File

go to project .ioc file and right click on it>>go to show in>>system explore>>select the project .ioc file and copy the path of the file.

Step 10: STM32CubeProgrammer

open STM32CubeProgrammer>>click on"+"to add the file.

Step 11: Adding File

Enter the url in search bar.

Step 12: Connect the STM32 Board

Connect the STM32 Board with STM32CubeProgrammer via USB and then download the file.

Step 13: On Board Led Blinking

The on-board led is blinking.