AnsweredAssumed Answered

Does one IRQx handler can be binding with multiple port?

Question asked by Carter Lee on Oct 17, 2017
Latest reply on Oct 17, 2017 by Danish Ali

Hi.

I'm not sure whether one IRQ handler can handle multiple ports.

For example, If I made one EXTI3_IRQHandler(), then I want to connect external interrupts PA0, PA1, PA2, PA3 to EXTI3_IRQHandler().

 

Is this possible way? if yes what am I supposed to do?

 

 

 

void EXTI0_Config(void)
{

 

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

 

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);


RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);


GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0);


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);

/* Enable and set EXTI0 Interrupt to the lowest priority */
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void EXTI1_Config(void)
{

 

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

 

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);


RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);


GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource1);


EXTI_InitStructure.EXTI_Line = EXTI_Line1;
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 = EXTI1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void EXTI2_Config(void)
{

 

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

 

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);


RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);


GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource2);


EXTI_InitStructure.EXTI_Line = EXTI_Line2;
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 = EXTI2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void EXTI3_Config(void)
{

 

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

 

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);


RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);


GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource3);


EXTI_InitStructure.EXTI_Line = EXTI_Line3;
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 = EXTI3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}

 

 

Does one IRQx handler can be binding with multiple port?

Outcomes