STM32CubeIDE:a Step by Step Guidance to Activate the On-Board LED of STM32 Black Pill
by Jasleen_kaur in Circuits > Microcontrollers
154 Views, 1 Favorites, 0 Comments
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
- STM32 Black Pill
- STMCubeIDE
- STMCubeProgrammer
- USB C Cable
Make a New Project File in STM32CubeIDE
Go to files>New>STM32 Project>>Nme the project
Add the Configurations for Your STM Board
Enter the Commercial Part Number :STM32F401CCU6>Select the required and then click on"Next".
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.
Configure the Clock
click on clock configuration and select the HSE in source MUX and system MUX.then Click on resolve clock issues.
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.
Main.c
project>>core>>src>>main.c
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);
Debug
Debug the file.
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.
STM32CubeProgrammer
open STM32CubeProgrammer>>click on"+"to add the file.
Adding File
Enter the url in search bar.
Connect the STM32 Board
Connect the STM32 Board with STM32CubeProgrammer via USB and then download the file.
On Board Led Blinking
The on-board led is blinking.