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
434 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.

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

As per the Laptop/PC specifications install the software.
Downloads
Install STM-32 CUBE Programmer

As per the Laptop/PC specifications install the software.
Downloads
Create a New Project in Stm-32 CubeIDE

Select "File">>"New"
Click on STM32 Project under the dialog box open.
Select Stm-32 Part

Fill "STM32F401CE" in the blank space of commercial part number.
Choose the part and click on "Next"
Setup STM32 Project

Click on "Finish".
As a result, New project with "LED HAL PROGRAM" title would be formed.
Setup SYS Mode & Configuration

Select "Serial Wire" in Debug dialog box.
Setup RCC Mode & Configuration

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

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

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

Click on "System Explorer" to copy path of file.
Open STM32 Cube Programmer


Beside the "Device Memory" and click on "Open File".
Fill the copied file path name.
Uploading Program in STM32

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
