Skip to main content
Carter Lee
Associate III
October 17, 2017
Solved

PB1 and PA1 are using the same EXT1?

  • October 17, 2017
  • 2 replies
  • 1102 views
Posted on October 17, 2017 at 10:45

Hi.

I'd like to use external interrupt PA1 nad PB1 pin.

But I found the following image, I think I can't use the external interrupt PA1 and PB1. Probably I think I have to  use only one to interrupt set.

Can I separately set to the one EXTIx?

because before system already use PB1 for external interrupt 

/* PB1 is connected to EXTI_Line0 :: Configuration AFIO_EXTICRx */

GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource1);

/* EXTI Line0 Configuration */

EXTI_InitStructure.EXTI_Line = EXTI_Line1;

EXTI_InitStructure.EXTI_LineCmd = ENABLE; /* Enable interrupt */

EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; /* Interrupt mode */

EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;

EXTI_Init(&EXTI_InitStructure);

/* Enable and set EXTI0 Interrupt to the lowest priority */

NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

but I want to add another external interrupt PA0,PA1,PA2,PA3. in this situation, what am I supposed to do ?

0690X00000608aCQAQ.png
    This topic has been closed for replies.
    Best answer by Szymon PANECKI
    Posted on October 17, 2017 at 11:51

    Hello Carter Lee,

    Your assumption is correct. Because of the fact, that EXTI1 is connected to all Px1 pins (PA1, PB1, PC1, ...), only one of them can be used as a source of interrupt in one time. So in your case it can be either PA1 or PB1.

    Regards

    Szymon

    2 replies

    Szymon PANECKI
    Szymon PANECKIBest answer
    Senior III
    October 17, 2017
    Posted on October 17, 2017 at 11:51

    Hello Carter Lee,

    Your assumption is correct. Because of the fact, that EXTI1 is connected to all Px1 pins (PA1, PB1, PC1, ...), only one of them can be used as a source of interrupt in one time. So in your case it can be either PA1 or PB1.

    Regards

    Szymon
    Uwe Bonnes
    Chief
    October 18, 2017
    Posted on October 18, 2017 at 11:24

    It is a pity that ST uses a multiplexer for the EXTI inputs and not a gated OR with a bitmask for selected active inputs.