yefj
Advanced Member level 5
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.
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: