STM32 Black Pill and STM Cube IDE to Blink On-board LED

by tanushree4587be23 in Circuits > Microcontrollers

163 Views, 1 Favorites, 0 Comments

STM32 Black Pill and STM Cube IDE to Blink On-board LED

FH1HBK4LUO3UE4F.png

ST Microelectronics has created their own IDE for programming their STM32 microcontroller devices. This is called STM32CubeIDE. This IDE integrates several ST software components that will make debugging and programming of your ST devices much easier. STM32CubeIDE is an all-in-one multi-OS development tool, which is part of the STM32Cube software ecosystem. STM32CubeIDE is an advanced C/C++ development platform with peripheral configuration, code generation, code compilation, and debug features for STM32 microcontrollers and microprocessors. It is based on the Eclipse®/CDT™ framework and GCC toolchain for the development, and GDB for the debugging. It allows the integration of the hundreds of existing plugins that complete the features of the Eclipse® IDE.

STM32CubeIDE integrates STM32 configuration and project creation functionalities from STM32CubeMX to offer all-in-one tool experience and save installation and development time. After the selection of an empty STM32 MCU or MPU, or preconfigured microcontroller or microprocessor from the selection of a board or the selection of an example, the project is created and initialization code generated. At any time during the development, the user can return to the initialization and configuration of the peripherals or middleware and regenerate the initialization code with no impact on the user code.

Key benefits

1- Debug made easy​

STM32CubeIDE helps quickly debug your application through enhanced features such as live watch of data variables and special register views.

2- Faster development​

Code editing, project build, board programming, and debugging are all integrated for a seamless and faster development cycle.​


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.

Install STM32CubeIDE

Screenshot 2024-03-31 131108.png
Screenshot 2024-03-31 131108.png
Screenshot 2024-03-31 131118.png
Screenshot 2024-03-31 131513.png
Screenshot 2024-03-31 131626.png
Screenshot 2024-03-31 131639.png
Screenshot 2024-03-31 133026.png
Screenshot 2024-03-31 133045.png
Screenshot 2024-03-31 133214.png
Screenshot 2024-03-31 133524.png
Screenshot 2024-03-31 133645.png
Screenshot 2024-03-31 133659.png
  1. Install the stm32CubeIDE .
  2. Create the account on the software by clicking on Create a MyST account.
  3. After That validate your email.
  4. Extract your software.
  5. Choose the location for the software.

Making a New Project File in STM32CubeIDE

FEUSTEELT5T3JFL.png

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

ADD Configurations for Your STM Board

Screenshot 2024-03-31 214607.png
Screenshot 2024-03-31 215058.png
Screenshot 2024-03-31 235050.png

Search For Component- STM32F401CCU6 click on "Next".

Configuring Your Board

FCEC07DLUPJA1NM.png
FGSCSE4LUPJA1OX.png

Configure Your Board As Shown.

Configure Your Clock

FF3O6T6LUPJA1QL.png

Open Main.c File

FZ8121SLT5T3KON.png

GOTO Project and find main.c file

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

FXAH6TLLT5T3KUB.png

I used GPIO Pin 13 you need not necessarily use this input pin . You can opt for 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);

Debug

F28B2SHLT5T3KZ7.png

Open and Click On Debug.

Copy Path of .elf File Generated

FA9KX7RLT5T3L9C.png

Right click on Project and click on show in system explorer and copy the path

Open STMCubeProgrammer and Connect to STM Board Via USB

FOEPK4ZLT5T3LJ0.png

Click on Open File and Paste the Copied Path

FK4GRO0LT5T3LLQ.png

Go to Download Options (Found in Toolbar on the Left)

FXTQHFPLT5T3LO2.png

Change Download Options and Click on "Start Automatic Mode"

FFKBDKCLT5T3LYV.png

Blink On-board LED

Screenshot 2024-04-07 195229.png

As we can see our on board LED is blinking.