AnsweredAssumed Answered

f4discovery : weird gpio behavior

Question asked by Jean_Georges.Valle on Apr 17, 2013
Latest reply on Apr 21, 2013 by Jean_Georges.Valle
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 : 
 #define PORTBTN GPIOE
#define RCC_AHB1Periph_PORTBTN RCC_AHB1Periph_GPIOE
#define PLAYER1_PIN GPIO_Pin_0
#define PLAYER2_PIN GPIO_Pin_1
#define EXTI_PortSource_PORTBTN EXTI_PortSourceGPIOE

GPIO_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) : http://i.imgur.com/QZw4vOm.png

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

Outcomes