After Configuration and Project Setup we need to add below code in order to blink the LED.
In main.c file, in main() function we need to add
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_6);
HAL_Delay(200);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
Where,
HAL_GPIO_TogglePin - Function to Toggle Pin/LED.
HAL_Delay - Delay function, here delay of 200msec is given.
Save, It will prompt for code generation, then Project>Build All. Debug(elf/hex) file will be generated.
For flashing/Debugging,
1. Connect USB and ST Link V2 Debugger
2. Use option Run>Debug As>1 STM32 C/C++ Application for programming/debugging.
If ST Link connection is not done then following Error will be prompted:
No comments:
Post a Comment