2013-04-17 01:08 PM
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 #pullup2013-04-20 08:12 AM
hey guyses,
there's definitely something wrong in danemark's kingdom.... (gdb) x/4w GPIOE0x40021000: 0x00000000 0x00000000 0x00000000 0x00000000GPIOEADR: MODER TYPER SPEEDR PUPDR(all according to family datasheet)MODER = 0 -> InputTYPER & SPEEDR -> irrelevant in input modePUPDR = 0 -> FLOATINGbut with the gpio disconnected from the pin the ohmeter read 32ohm between (GPIOE_Pin_1|GPIOE_Pin_0) & THE board's GND pin... when it should be completely disconnected in floating mode... missed something specific about GPIOE ? faulty chip / bad batch (anywhere i can find this kind of info) ? bug in silicon ? anyone have any other idea ?on a side note, i switched to GPIOC and it's working now but it's still weird....
2013-04-20 08:52 AM
You understand that PE0/PE1 are connected to other components on the board, right?
PE3..15 are not connected to anything. Make sure the clock is enabled for the GPIOE bank, that you can read/write values into the registers.2013-04-21 04:27 AM
Hey clive, i sure understand this.
<edit>clive, just to clear up something i wasn't really clear about, Myboard gnd is directly connected to DiscoBard ground and idisconnected
the gpio pins before measuring between gpiopin0 on discoboard and gnd on discoboard and after gpiopin1 on discoboard and gnd on discoboardthese two measurements give 32 ohms in spite of the gpioeport beeing clocked and properly setup as floating inputs.</edit>What i don't is why, in spite of beeing setup as described sooner it's not working as documented for gpioe but is indeed working as documented for gpioc (just by changing the adressed gpio in the defines) and the interrupts fires quite correctly on press or release of the buttons.gpioe is behaving as if i had set it up with a pull down (is 32ohms compatible with the weak pull down embedded resistor ?).i still think there's something either wrong with gpioe on my chip or board or i missed something in the documentation that is related to this particular gpio port. that's what i'd like to know since i have to evaluate this board as a possible candidate for an embedded arm workshop i'll give next year and either document it as expected behavior ...or just as a possible default (in this case the chances are the boards we'll order will be from another batch and won't suffer from it)jege2013-04-21 04:51 AM
2013-04-21 07:58 AM
clive !
My hero ! i neglected to look at the board datasheet itself !Now i understand :)(just maybe next time indicate the doc reference, had a hard time digging this one)thanks a bunch !jegeva