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

by sachin_ahlawat in Circuits > LEDs

5 Views, 0 Favorites, 0 Comments

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

Screenshot 2024-04-11 200725.png

"Step-by-Step Guide: Mastering STM32CubeIDE - How to Light Up the On-Board LED of the STM32 Black Pill"


"Hello and welcome to our technical tutorial on how to use STM32CubeIDE to control the LED on the STM32 Black Pill microcontroller. This tutorial is carefully crafted to provide professionals with a clear and easy-to-follow guide on controlling the LED, demonstrating the capabilities of the STM32 Black Pill and STM32CubeIDE. We will cover the basics of embedded development, including setting up your environment, understanding the hardware of the Black Pill, and writing efficient code for LED management. This foundational exercise is crucial for mastering embedded systems and will set the stage for more complex projects. Come join us as we explore the principles."

Downloads

Supplies

"Before you start learning embedded programming, make sure you have the necessary equipment and software set up:

1. A laptop or desktop computer with STM32CubeIDE and STM32CubeProgrammer installed.

2. An STM32 Black Pill development board.

3. A USB cable that is compatible for both connecting and programming. It is important to have these items ready before beginning the tutorial for a smooth and successful programming experience."

Creating a New Project File in STM32CubeIDE

Screenshot 2024-04-11 194021.png

 GOTO---->> File>New>STM32 Project

Adding Configurations for Your STM Board

Screenshot 2024-04-11 194321.png

Look for Component - STM32F401CEY6TR and then click on "Next".

Board Configuration

Screenshot 2024-04-11 194520.png

configure the board

Configuration of the Clock

Screenshot 2024-04-11 194630.png

configure the clock as shown

Open Main.c File

Screenshot 2024-04-11 194812.png

GOTO Project and find main.c file

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

Screenshot 2024-04-11 194931.png

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 1);

HAL_Delay(500);

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 0);

HAL_Delay(500);

Debug

Screenshot 2024-04-11 195220.png

choose the debug option

Copy the Path of the .elf File Generated.

Screenshot 2024-04-11 195552.png

Right-click on the project and select "Show in System Explorer," then copy the path.

Launch STM32CubeProgrammer and Establish a USB Connection With the STM Board.

Screenshot 2024-04-11 195829.png

Select "Open File" and Then Paste the Copied Path.

Screenshot 2024-04-11 200005.png

Navigate to the Download Options, Located in the Toolbar on the Left Side.

Screenshot 2024-04-11 200109.png

Adjust the Download Options Accordingly, Then Proceed to Click on "Start Automatic Mode."

Screenshot 2024-04-11 200217.png

Now Its Done

WhatsApp Image 2024-04-11 at 20.03.39_8c997cc6.jpg

now you can see led is blinking