Skip to main content
johan2
Associate
September 16, 2014
Question

Using multiple GPIO interupts with STM32L053 Nucleo board

  • September 16, 2014
  • 2 replies
  • 712 views
Posted on September 16, 2014 at 13:54

I am trying to use multiple interupts on my nucleo board. I have used the cube hal. My problem is that I dont get the interrupts generated on the PB0 pin, but the PB1 works ok.

I have tried to do the intialization in different order and it seems like it works better, but I dont understand why the HAL needs calls in a specific order.

My code to initialize the interrupts are based on the GPIO_EXTI example:

static void EXTI_Config(void)

{

  GPIO_InitTypeDef   GPIO_InitStructure;

  /* Enable GPIOB clock */

  __GPIOB_CLK_ENABLE();

  /* Configure PB0 pin  */

  GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;

  GPIO_InitStructure.Pull = GPIO_PULLUP;

  GPIO_InitStructure.Pin = GPIO_PIN_0;

    GPIO_InitStructure.Speed = GPIO_SPEED_FAST;

  HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);

    

    

  /* Configure PB1 pin  */

  GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;

  GPIO_InitStructure.Pull = GPIO_PULLUP;

  GPIO_InitStructure.Pin = GPIO_PIN_1;

  GPIO_InitStructure.Speed = GPIO_SPEED_FAST;

  HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);

    

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

  HAL_NVIC_SetPriority(EXTI0_1_IRQn, 3, 0);

  HAL_NVIC_EnableIRQ(EXTI0_1_IRQn);

}

    This topic has been closed for replies.

    2 replies

    Amel NASRI
    ST Technical Moderator
    September 18, 2014
    Posted on September 18, 2014 at 12:39

    Hello Johan,

    Could you please let us know what was the working sequence & the non-working one?

    Thanks

    -Mayla-

    To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
    Montassar BEN ROMDHANE_O
    Visitor II
    September 18, 2014
    Posted on September 18, 2014 at 17:52

    Hihedlund.johan,

    Please find attached a GPIO_EXTI project using mutliple GPIO interrupts on PB0 and PB1 with the STM32L053 Nucleo board and the STM32Cube_FW_L0_V1.1.0 package available

    http://www.st.com/web/en/catalog/tools/PF260508#

    .

    Let's try with this and keep us informed with your finding.

    # Please extract atSTM32Cube_FW_L0_V1.1.0\Firmware\Projects\STM32L053R8-Nucleo\Examples\GPIO

    Cheers,

    Heisenberg.

    ________________

    Attachments :

    GPIO_EXTI_MUL.7z : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzZR&d=%2Fa%2F0X0000000bNh%2FK6hlu6yoDNmIu_rpjdKI1xQ21dB6IAR1hsuJedxK7E8&asPdf=false