AnsweredAssumed Answered

Programming STM32F407VG Discovery Board in Register Level

Question asked by Y_ld_z.Recep_Onur on Apr 29, 2017
Latest reply on May 4, 2017 by Y_ld_z.Recep_Onur

Hello,

I am trying to programming my board using registers in Ref. Man. I used TI MSP430. Therefore, i am familliar with registers. But, when i try to blink the leds under the button's control, it is not easy for me. Here is the part of my code;

                                       int main(void){
                                            RCC -> AHB1ENR |= 0x00000009;
                                            GPIOD -> MODER |= 0x55000000;
                                            GPIOA -> MODER &= 0x00000000;
                                            GPIOD -> OTYPER |= 0x00000000;
                                            GPIOA -> OTYPER |= 0x00000000;
                                            GPIOD -> OSPEEDR |= 0x55000000;
                                            GPIOA -> OSPEEDR |= 0x00000001;
                                            GPIOD -> PUPDR |= 0x00000000;
                                            GPIOA -> PUPDR |= 0x00000001;

In the debug mode, after the bold line, i get this error;

                                    

What is the reason for that error? Did i make somehing wrong?

There is also one more thing. I try to read the button's value with "GPIOA -> IDR" register. I writed that code below to read;

                                       if(GPIOA -> IDR == 0x00000001 )

Is it right? Because, in the debug mode, the IDR value is not change when i press the button. IDR value always is 0x000085CF. Thats why the code cannot detect if it is pressed.

 

Best regards.

Outcomes