Steps to Start With STM Cube IDE and to Blink On-board LED Using HAL Programming by STM32 Black Pill.

by bsimrat02 in Circuits > Microcontrollers

304 Views, 2 Favorites, 0 Comments

Steps to Start With STM Cube IDE and to Blink On-board LED Using HAL Programming by STM32 Black Pill.

Screenshot 2024-03-02 122604.png

Technical tutorial on harnessing the capabilities of STM32CubeIDE to control the on-board LED of the STM32 Black Pill microcontroller. This guide is meticulously crafted to provide professionals with a clear and concise walkthrough for engaging the LED, demonstrating the STM32 Black Pill's functionalities and the versatility of STM32CubeIDE.


Supplies

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

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

2. An STM32 Black Pill development board.

3. A compatible USB cable for connection and programming purposes.

Please ensure that these prerequisites are met prior to beginning the tutorial to facilitate a smooth and efficient programming experience.

Downloads

Install STM-32 CUBE IDE

Screenshot 2024-03-02 123354.png

As per the Laptop/PC specifications install the software.

Downloads

Install STM-32 CUBE Programmer

Screenshot 2024-03-02 123259.png

As per the Laptop/PC specifications install the software.

Create a New Project in Stm-32 CubeIDE

Screenshot 2024-03-02 124340.png

Select "File">>"New"

Click on STM32 Project under the dialog box open.

Select Stm-32 Part

Screenshot 2024-03-02 125049.png

Fill "STM32F401CE" in the blank space of commercial part number.

Choose the part and click on "Next"

Setup STM32 Project

Screenshot 2024-03-02 125228.png

Click on "Finish".

As a result, New project with "LED HAL PROGRAM" title would be formed.

Setup SYS Mode & Configuration

Screenshot 2024-03-02 125851.png

Select "Serial Wire" in Debug dialog box.

Setup RCC Mode & Configuration

Screenshot 2024-03-02 125909.png

Select "Crystal/Ceramic Resonator" in High Speed Clock dialog box and disable the Low Speed Clock.

Open Source Code File

Screenshot 2024-03-02 131202.png

In the "Project Explorer" select the project name and under that choose "SRC" under "core".

Click on "main.c file" to generate code file and update the code.

Update the Code of HAL Program

Screenshot 2024-03-02 131957.png

Fill the following code under the "While" statement:

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 1);

HAL_Delay(500);

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 0);

HAL_Delay(500);

Copy Path of Project File Generated

Screenshot 2024-03-02 132834.png

Click on "System Explorer" to copy path of file.

Open STM32 Cube Programmer

Screenshot 2024-03-02 133351.png
Screenshot 2024-03-02 133427.png

Beside the "Device Memory" and click on "Open File".

Fill the copied file path name.

Uploading Program in STM32

Screenshot 2024-03-02 134248.png

Connect the STM Board Via USB.

After the connection click on "Download" and fill the blank space with file path. Select the checkboxes and click on "Start Automatic Mode".


LED Starts Blinking

WhatsApp Image 2024-03-02 at 23.01.42.jpeg