0

i need to configure an exti interrupt on A1 port of my stm32f103 board. I create a template with stm32cubemx but i'm trying to configure interrupt manually because it's a new feature of my code that i've already wrote. i'm reading many topics but i not found any solution. In this project i use the HAL library and i follow this steps:

configure the GPIO

      GPIO_InitStruct.Pin = GPIO_PIN_1;
      GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
      GPIO_InitStruct.Pull = GPIO_NOPULL;
      GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
      HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

Enable IRQ

     HAL_NVIC_SetPriority(EXTI1_IRQn, 3, 0);
     HAL_NVIC_EnableIRQ(EXTI1_IRQn);

Customizing the callback

      void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
     {
      if(GPIO_Pin == STEP_PIN)
      {
        GlobalMotorData.step.longint++;
      }
     }

i wrote The callback function in a new .c file and i do not touch the same function inside stm32f1xx_hal_gpio.c

i not enabled the macro HAL_EXTI_MODULE_ENABLED because the project not find the corrisponding .h header file but without the macro, code builds without errors.

What i forgot?

thank you

1 Answers1

0

You are most likely missing the EXTI1 interrupt handler:

void EXTI1_IRQHandler(void)
{
    HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1);
}
Codo
  • 75,595
  • 17
  • 168
  • 206