Introduction: Blinking of Onboard Led Using STM32-Black Pill

Welcome to our tutorial on using STM32CubeIDE to control the on-board LED of the STM32 Black Pill microcontroller. We'll guide you through setting up the environment, understanding hardware specifics, writing LED control code, and testing/debugging. By the end, you'll confidently manipulate the LED using STM32CubeIDE. Let's get started!

Supplies

STM32-Black Pill, STMCubeIDE.

Step 1: Making a New Project File in STM32CubeIDE

Open stm IDE>file>new>stm project.

Step 2: ADD Configurations for Your STM Board

Search For Component- STM32F401CEY6TR click on "Next"

Step 3: Configuring Your Board

Step 4: Clock Configuration

Step 5: Open Main.c File

Step 6: Goto While(1) in Main() and Add Your Code

Write this under the while section:

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 1);

HAL_Delay(500);

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 0);

HAL_Delay(500);

Step 7: Debug

Step 8: Copy Path of .elf File Generated

Step 9: Open STMCubeProgrammer and Connect to STM Board Via USB

Step 10: Click on Open File and Paste the Copied Path

Step 11: Go to Download Options

Step 12: Change Download Options and Click on "Start Automatic Mode"