AnsweredAssumed Answered

Using multiple GPIO interupts with STM32L053 Nucleo board

Question asked by hedlund.johan on Sep 16, 2014
Latest reply on Sep 18, 2014 by Montassar BEN ROMDHANE
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);
}

Outcomes