This repository contains a beginner-friendly STM32CubeIDE project that blinks an LED on an STM32F446RET6 microcontroller using the STM32 HAL (Hardware Abstraction Layer).
It’s a simple embedded firmware example — perfect as a first STM32 project or for learning how to use CubeMX and HAL GPIO toggling.
- Configures a GPIO pin connected to an onboard LED.
- Toggles the LED on/off in a loop with a delay.
- Built using STM32CubeIDE with HAL drivers (no low-level register code).
This makes it easy to understand and modify for beginners.
STM32-LED-blink-HAL-coding-method/
├── Core/ → Source (`Src/`) and Header (`Inc/`) files
├── Drivers/ → HAL and CMSIS drivers
├── Startup/ → Startup assembly and linker scripts
├── STM32F446RETX_FLASH.ld → Linker script
├── STM32F446RETX_RAM.ld → RAM layout
├── LED_blink_HAL_project.ioc → CubeMX configuration
├── .project → IDE project metadata
├── .cproject → Toolchain config
├── .gitignore → Ignore build outputs
git clone https://github.com/DanielRajChristeen/STM32-LED-blink-HAL-coding-method.git
cd STM32-LED-blink-HAL-coding-method- Launch STM32CubeIDE
- Go to File → Import → Existing Projects into Workspace
- Select this folder
- Click the Build button in STM32CubeIDE
- Confirm there are no compile errors
- Connect your STM32F446RET6 board via ST-Link
- Use Run → Debug or Run → Run The LED should start blinking!
This project teaches:
- How to configure GPIO using CubeMX
- How HAL functions (
HAL_GPIO_TogglePin) work - How the build & debug process flows in STM32CubeIDE
Perfect for beginners stepping into embedded firmware development. ([STMicroelectronics][2])
- The HAL library simplifies peripheral access compared to low-level register programming.
- You can modify the LED blink speed in
main.c. - Make sure the correct board/MCU is selected when opening in CubeIDE.
This project is open-source. Use it, learn from it, and adapt it!
Inspired by embedded learning resources and STM32 community examples.
Happy hacking! 💡