Prerequisites
- STM32CubeIDE installed
- STM32 Nucleo development board
- USB cable and ST‑Link drivers
1) Create a project
In STM32CubeIDE, create a new project for your board. Generate code with HAL enabled and keep the default clock configuration.
2) Configure the LED pin
Enable the GPIO port of your user LED and configure the pin as push‑pull output, no pull‑up, low speed. (On many Nucleo boards the green LED is on PA5
—verify for your board.)
3) Minimal blink using HAL
#include "main.h"
int main(void) {
HAL_Init();
SystemClock_Config();
// ...
while (1) {
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
HAL_Delay(500);
}
}
4) Build & flash
Build the project and program the board via ST‑Link. You should see the LED blink at roughly 2 Hz.