cancel
Showing results for 
Search instead for 
Did you mean: 

Hello All, I am new to this community as well as STM32F407 Discovery board . I am trying to write a program to turn ON LED without using any library. I wrote the below code, But I am not able to compile it .

JSuda
Associate II

  #define RCC_AHB1ENR (*(volatile unsigned long *)0x40023830)

#define GPIOD_MODER (*(volatile unsigned long *)0x40020C00)

#define GPIOD_OTYPER (*(volatile unsigned long *)0x40020C04)

#define GPIOD_OSPEEDR (*(volatile unsigned long *)0x40020C08)

#define GPIOD_PUPDR (*(volatile unsigned long *)0x40020C0C)

#define GPIOD_ODR (*(volatile unsigned long *)0x40020C14)

/* Init Starts here */

main()

{

RCC_AHB1ENR = 0x00000008 ;

GPIOD_MODER = 0x40000000 ;

GPIO_OTYPER = 0x00000000 ;

GPIOD_OSPEEDR = 0x00000000 ;

GPIOD_PUPDR = 0x40000000 ;

/* Init Ends here */

/* LED ON */

GPIO_ODR = 0x10000000 ;

}

Please help me to understand where I am going wrong with the code.

Many Thanks in advance.

11 REPLIES 11

Thanks a lot . It is working now after adding while(1 ) loop and startup_code.

Thanks a lot @turboscrew​ . It helped a lot.