STM32 PORT D pin 15 led problem

Status
Not open for further replies.

yefj

Advanced Member level 4
Joined
Sep 12, 2019
Messages
1,236
Helped
1
Reputation
2
Reaction score
3
Trophy points
38
Activity points
7,433
Hello,I am trying to turn on a LED for STM32F407 descovery which is PORT D pin 15 as shown in the diagram bellow and the link attached to it.
I am using keil an ST-link debuger setting as shown bellow.
My STM32 descovery is connected as shown in the photo bellow.
I have written a simple code by the registers table shown bellow to put VDD on PD15 ,but nothing happens when i flash the program.
Where did i go wrong?
Thanks.



Code:
#include "stm32f407xx.h"

int main()
{ //RCC_AHB1ENR_GPIODEN
    RCC->AHB1ENR|=(1uL<<3); //set third bit to enable AHB1 BUS
    GPIOD->MODER&=~(1uL<<31);//reset 0 on 31 01 to gpio_moder 31,30 bits in register 
    GPIOD->MODER|=(1uL<<30);//set 1 on 30 output mode for pin 15 port D
    
    GPIOD->OTYPER=0; //all register is push pull
    GPIOD->OSPEEDR=0;//speed low
    GPIOD->ODR|=(1<<15); //Sets pin 15 as high
    
    
}




 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…