cancel
Showing results for 
Search instead for 
Did you mean: 

EXTI LINE?

orn
Associate II
Posted on November 12, 2012 at 18:41

I want to edit and use the example of EXTI PA3, but it does not work, what am I doing wrong?

void Exti_Config(void)
{
EXTI_InitTypeDef EXTI_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* Enable GPIOA clock */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Configure PA3 pin as input floating */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
GPIO_Init(GPIOA, &GPIO_InitStructure);
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource3);
/* Configure EXTI Line0 */
EXTI_InitStructure.EXTI_Line = EXTI_Line0;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; 
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* Enable and set EXTI Line0 Interrupt to the lowest priority */
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);
}

Instm32f4xx_it.c

void EXTI0_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line0) != RESET)
{
/* Toggle LED4 */
STM_EVAL_LEDOn(LED4);
/* Clear the EXTI line 0 pending bit */
EXTI_ClearITPendingBit(EXTI_Line0);
k=k++;
}
if(k==8){
STM_EVAL_LEDToggle(LED3);
k=0;
}
}

4 REPLIES 4
Posted on November 12, 2012 at 19:15

I want to edit and use the example of EXTI PA3, but it does not work, what am I doing wrong?

 

It ain't LINE 0 / EXTI 0 anymore.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
orn
Associate II
Posted on November 12, 2012 at 20:56

If I understand correctly PA3 is not connected to EXTI line 0?

could you tell me where to find a table or something similar indicating EXTI_LINE and pin to which it is associated? I looked in the manual but could not find, maybe try with the wrong name or something.

Posted on November 12, 2012 at 21:13

Px3 goes to EXTI3

0690X00000603FmQAI.jpg

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
orn
Associate II
Posted on November 12, 2012 at 21:42

thanks Clive!