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

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.

Step 1: Install STM32CubeIDE

  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.

Step 2: Making a New Project File in STM32CubeIDE

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

Step 3: ADD Configurations for Your STM Board

Search For Component- STM32F401CCU6 click on "Next".

Step 4: Configuring Your Board

Configure Your Board As Shown.

Step 5: Configure Your Clock

Step 6: Open Main.c File

GOTO Project and find main.c file

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

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);

Step 8: Debug

Open and Click On Debug.

Step 9: Copy Path of .elf File Generated

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

Step 10: Open STMCubeProgrammer and Connect to STM Board Via USB

Step 11: Click on Open File and Paste the Copied Path

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

Step 13: Change Download Options and Click on "Start Automatic Mode"

Step 14: Blink On-board LED

As we can see our on board LED is blinking.