AnsweredAssumed Answered

EXTI Problem with nucleo L152

Question asked by sadofiev.leonid on Dec 14, 2014
Latest reply on Dec 15, 2014 by Clive One
Hello,
I've got a strange problem with setting an interrupt for input pins on my Nucleo board. Actualy, no one interrupt except EXTI15_10_IRQn doesn't work. I'm attaching two portions of code, one using input pin 10 and EXTI15_10_IRQn works well, and the second one using pin 9 and EXTI9_5_IRQn doesn't work at all. Would anybody be so kind to point me what is wrong? Actualy I've tried all EXTI lines (from B0 to B15) with using of corresponding pins and EXTI lines and got working only pins B10-B15. No interrupts from other pins were obtained.

Thanks in advance
Leonid
-------------------------- WORKING CODE---------------------------------
//Initialization
void SetACInterrupts(void)
{
     EXTI_InitTypeDef EXTI_InitStructure;
     NVIC_InitTypeDef NVIC_InitStructure;


     /* Connect Button EXTI Line to Button GPIO Pin */
     RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);


     SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource10);


    /* Configure Button EXTI line */
    EXTI_InitStructure.EXTI_Line = EXTI_Line10;
    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 Button EXTI Interrupt to the lowest priority */


    //Selecting the channel depending on Pin number
    NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    NVIC_Init(&NVIC_InitStructure);
}

//Handler

void ACZeroHandler(void);

void EXTI15_10_IRQHandler(void)
{
     ACZeroHandler();
}

-------------------------- NOT WORKING CODE-------------------------
//Initialization
void SetACInterrupts(void)
{
     EXTI_InitTypeDef EXTI_InitStructure;
     NVIC_InitTypeDef NVIC_InitStructure;

     /* Connect Button EXTI Line to Button GPIO Pin */
     RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

     SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource9);

    /* Configure Button EXTI line */
    EXTI_InitStructure.EXTI_Line = EXTI_Line9;
    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 Button EXTI Interrupt to the lowest priority */

    //Selecting the channel depending on Pin number
    NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    NVIC_Init(&NVIC_InitStructure);
}

//Handler. Never to be called!

void EXTI9_5_IRQHandler(void);
          
void EXTI9_5_IRQHandler(void)
{
     ACZeroHandler();
}





Outcomes