GPIO from STM32F1 to STM32F4 (digital in)
Hi, I am currently porting robotics software from STM32F1 (Cortex M3) to STM32F4 (Cortex M4). I want to write a simple program to switch on an LED via digital out. The program is supposed to send a digital input interrupt from a pushbutton and output to LED when it is pressed. Somehow I cannot get my digital input configuration to work. I get strange result, which is, I can only initialize GPIO pin for input from GPIO-E Pin 0. After this, initialization does not work. Even if I only used Pin 0 in my code, it does not work. So I commented off initialization for the rest of the pins and use polling technique for Pin 0 (if-else button is pushed, turn off LED). It still does not work. Any idea where to look?
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_Init(GPIOE, &GPIO_InitStructure); // Initialize pin 0 //CODE DOES NOT WORK BELOW THIS POINT GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; GPIO_Init(GPIOE, &GPIO_InitStructure); // Initialize pin 1 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_Init(GPIOE, &GPIO_InitStructure); // Initialize pin 2 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; GPIO_Init(GPIOE, &GPIO_InitStructure); // Initialize pin 3 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_Init(GPIOE, &GPIO_InitStructure); // Initialize pin 4 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; GPIO_Init(GPIOE, &GPIO_InitStructure); // Initialize pin 5 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; GPIO_Init(GPIOE, &GPIO_InitStructure); // Initialize pin 6 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; GPIO_Init(GPIOE, &GPIO_InitStructure); // Initialize pin 7 #gpio-digital-in