2012-01-31 01:53 PM
Here is my code block for setting up the EXTI for Port B pin 0:
void
VFD_Busy_EXTI_Init(
void
){
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_In_Floating;
GPIO_Init(GPIOB,&GPIO_Init_Structure);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource0);
EXTI_InitStructure.EXTI_Line = EXTI_Line0
EXTI_InitStructure.EXTI_Mode_Interupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
Anyone see anything wrong or missing? The symptom is the EXTI ISR is never called. (yes the hardware is confirmed fine)
2012-01-31 02:25 PM
With local variables I'd want to be real sure I initialized them completely so they don't hold random junk.
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interupt; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;2012-01-31 02:29 PM
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
can you add this line before NVIC code and see if it works2012-01-31 04:41 PM
@clive: You had me going there for a moment! I thought you found it. Alas it was a transcription error in my post. The code is actually fine.
@clive, @karakaya.mehmet: Prioritygroup0 is set earlier in the code but I can try setting it again here. I believe that does away with the need for the preemption priority setting you called out clive. I'm going to add the structure init functions to the top of this. As clive pointed out, perhaps there is some garbage in there.Beyond that I'm at a loss. I will try another physical pin to see if perhaps I have a bad PB0 on two boards but it seems unlikely. Actually as I think about it, I used the EXTI software interupt function to simulate pin change and it still didn't fire so bad pin is out.2012-01-31 06:56 PM
If software firing isn't working, I'd be looking at the vector table, and making sure the IRQ routine is correctly named. What's the IRQ code look like, and how are you confirming if it is firing or not firing?
EXTI_GenerateSWInterrupt(EXTI_Line0); The hardware is presumably PB.0 pulled high, with a button to ground. Can you get to PA.0, or play with the EXTI on other pins?2012-02-03 12:15 PM
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_In_Floating;
GPIO_Init(GPIOB,&GPIO_Init_Structure);
Are you sure the HW is confirmed? Maybe you need to configure the input as pull-up or pull-down.
- Also, in my STM32F10x library, the definition is: ''GPIO_Mode_IN_FLOATING.'' Maybe you are not using the F10x?
- Finally, you should probably give a speed, like: ''GPIOinit.GPIO_Speed = GPIO_Speed_50MHz;'' If you look in stm32f10x_gpio.h, you will see that 0 is not an enumerated value supported in GPIOSpeed_TypeDef. So the result is going to be unpredictable.
2012-07-06 10:37 AM
Although you have already achieved.
I decided to make an example attached. Even simulates and it worked fine also attached. Best Regards!!! Erisson ________________ Attachments : EXTI_ERISSON.rar : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtHi&d=%2Fa%2F0X0000000aL4%2FOC.H3r79LwoNhDVf5wPbF65kCsm5VPJYq2KtTspyBqQ&asPdf=falseEXTI_PB0.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtUR&d=%2Fa%2F0X0000000aQk%2Fhl7phK161ow4q6hpNMhlXJzwNX7uqOfg97HqA8A.J3M&asPdf=false