Question
f4discovery : weird gpio behavior
Posted on April 17, 2013 at 22:08
Hello fellow f4/stm32 Users.
I just bought a f4Discovery and i'm trying to get a grip on this great ''little'' piece of hardware.i'm trying to do very basic things just to get a grip by reimplementing a little piece of a game i made a while ago. (basically driving leds through 595 with some microswitches as input).Here is my problem :i'm trying to trigger an nvic interrupt on GPIOE set like that : &sharpdefine PORTBTN GPIOE&sharpdefine RCC_AHB1Periph_PORTBTN RCC_AHB1Periph_GPIOE&sharpdefine PLAYER1_PIN GPIO_Pin_0&sharpdefine PLAYER2_PIN GPIO_Pin_1&sharpdefine EXTI_PortSource_PORTBTN EXTI_PortSourceGPIOEGPIO_InitStructure.GPIO_OType = GPIO_OType_PP;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;GPIO_InitStructure.GPIO_Pin = PLAYER1_PIN|PLAYER2_PIN;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;GPIO_Init(PORTBTN, &GPIO_InitStructure);interrupt setup: SYSCFG_EXTILineConfig(EXTI_PortSource_PORTBTN, EXTI_PinSource0|EXTI_PinSource1); EXTI_InitStructure.EXTI_Line = EXTI_Line0; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure);but, this is provoking something strange in my hardware around the microswitches.(the behavior is normal with the �c it was develloped for originally, namely atmega, same thing with a msp, another arm and a cypress ).the hardware setup is (sorry image manager not working for me) : with all the other �c, VD between the +5 side of the resistor & iopin side is +5v is ~0v without pushing the �switch and +5 while pushing (yey pullup...)as soon as i plug the pin in it goes +5v all the time, just like if the GPIO pins were already grounded... i didn't put any pulldown while configuring the pin so... i'm surely missing something pretty important here regarding the STM gpios....any idea what ?sincerely,jege #discovery #stm32f4 #gpio #pullup