AnsweredAssumed Answered

Problem blink led "STM32F4 DISCOVERY"

Question asked by POSIX on Apr 23, 2016
Latest reply on Apr 24, 2016 by POSIX
Hello, I recently purchased the above development board and I am trying to program it. Following the reference manual I was able to write a small program to turn some LEDs, the problem is that once the code is compiled to "C IDE" and "Eclipse" and after the correct binary upload does not work. Someone more experienced can kindly help me out ?? the code is as follows.

#define RCC             (unsigned int*)    (0x40023830)           //indirizzo base RCC "Reset and Clock Control" 0x40023800 + offset 0x30 per il bus AHB1
#define AHB1_ENR        (unsigned int)     (1<<3)                 //abilito il clock sul bus AHB1 per i pin GPIOD
   
#define ADDRESS_GPIOD   (unsigned int)     (0x40020C00)           //registro base per i pin GPIOD
 
#define GPIOD_MODER     (unsigned int*)    (ADDRESS_GPIOD+0x00)   //registro per la modalita I/O               offset 0x00
#define GPIOD_OUT       (unsigned int)     (1<<30)
 
#define GPIOD_OTYPER    (unsigned int*)    (ADDRESS_GPIOD+0x04)   //registro per il tipo di  I/0               offset 0x04
#define GPIOD_OSPEEDR   (unsigned int*)    (ADDRESS_GPIOD+0x08)   //registro per la velocità I/0               offset 0x08
#define GPIOD_PUPDR     (unsigned int*)    (ADDRESS_GPIOD+0x0C)   //registro Papp o Pulldown I/0               offset 0x0C
 
#define GPIOD_BSRR      (unsigned int*)    (ADDRESS_GPIOD+0x14)   //registro per il set o il reset dell'I/0    offset 0x18
 
#define GPIOD12_ON      (unsigned int)     (1<<15)
#define GPIOD12_OFF     (unsigned int)     (1<<28)
 
 
 
void delays(int num)
{
int count;
for(count=0;count<=num;count++){}
}
 
int main(void)
{
unsigned int *REGpointer;
REGpointer = RCC;
*REGpointer |= AHB1_ENR;
REGpointer = GPIOD_MODER;
*REGpointer |= GPIOD_OUT;
REGpointer = GPIOD_OTYPER;
*REGpointer |= 0;
REGpointer = GPIOD_OSPEEDR;
*REGpointer |= 0;
REGpointer = GPIOD_PUPDR;
*REGpointer |= 0;
 
REGpointer = GPIOD_BSRR;
 
 
while(1)
    {
        *REGpointer |= GPIOD12_ON;
        delays(1000);
        *REGpointer |= GPIOD12_OFF;
        delays(1000);
    }
}
Surely there is something wrong or incomplete.

best regards

Outcomes