cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 blink project not working

ATAB.1
Associate

I'm trying to figure out if the board is functional by trying the simple on board LED blink project, the board is STM32F407VGT6 and IDE is Keil uVision5. I'm using the code below:

#include "stm32f4xx_hal.h"
 
void configureLEDpins(void);
void msDelay(uint32_t msTime);
 
int main(void){
 
	configureLEDpins();
 
	while(1){
	
	HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15);
	msDelay(1000);
	}
} 
 
void configureLEDpins(void){
	__HAL_RCC_GPIOD_CLK_ENABLE();
 
	GPIO_InitTypeDef myLEDConfig;
	myLEDConfig.Mode = GPIO_MODE_OUTPUT_PP;
	myLEDConfig.Pin  = GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
	
	HAL_GPIO_Init(GPIOD, &myLEDConfig);
}
 
void msDelay(uint32_t msTime){
	for(uint32_t i=0; i<msTime*4000; i++);
}

Initially all 4 LEDs are on but as soon as I download the code to flash memory they turn off and won't blink. I got the code from a Youtube video where the code works and the LEDs blink. I looked at my board datasheet and the LEDs pin numbers appear to be correct. So am I missing something here or the problem is the board itself ?

0 REPLIES 0