cancel
Showing results for 
Search instead for 
Did you mean: 

EXTI Problem with nucleo L152

leosad
Associate II
Posted on December 14, 2014 at 14:21

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

}

#exti-interrupt-error
3 REPLIES 3
Posted on December 14, 2014 at 17:19

Using .cpp?

How are pins configured?
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
leosad
Associate II
Posted on December 15, 2014 at 09:41

No C++ usage, pure C project (Atolic). Pins are configured as inputs. Pin configuration code is located in other function, and it was same for all pins used. Acualy, all GPIOB pins are configured identically as inputs (NOPUPP, PP, 40 MHz) and all of them works fine in terms of reading of incoming data. The problem is  - only pins 10 to 15 genertes an interrupt. Looks like system doesn't see handler for other EXTI lines. 

I've noticed the fact - EXTI15_10 is in use by sample code for user input button on Nucleo board. I've removed user button configuration code from my project, but maybe where were some additional configuration steps I haven't detected and they makes EXTI15_10 work in my code... All conditions 

Posted on December 15, 2014 at 10:39

At a glance your code doesn't look unreasonable. I don't have specific experiences with the Nucleo L152 board, but other STM32 work and route the EXTI signals appropriately.

Might want to double check the startup file, the vectors therein, and the .MAP file linkage of the IRQHandler
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..