cancel
Showing results for 
Search instead for 
Did you mean: 

Can't run EXTI on Nucleo65-H503

username007
Associate II

Hello!

 

I'm following the STM32 tutorial on External interrupts from here and got stuck. 

The controller doesn't react to the press of button and the IDE for some reason switched to tab of `startup_stm32h503rbtx.s`.

 

Reproducing steps:

1. Create a new project (STM32 Project)

2. Select Nucleo H503 as target board

3. Go to PinOut and configuration, change mode of  PC13 to GPIO_EXTI13

4. Go to GPIO tab, select mode External Interrupt with Falling edge, without Pull-up ot Pull-down, set user label to B1

5. Go to NVIC tab and enable `EXTI Line 13 interrupt`, press `Ctrl + S`

6. Go to section user Code 4 of main.c and insert the following function into it:

 

/* USER CODE BEGIN 4 */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  if(GPIO_Pin == GPIO_PIN_13) {
    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
  } else {
      __NOP();
  }
}
/* USER CODE END 4 */

 

7. Save and run

 

Used parts:

- board: Nucleo64-H503

- IDE : Stm32CubeIDe 1.15.1

- STLink Firmware: V3.J15.M6

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

Hello @username007

 

As you are configuring the PC13 as External Interrupt with Falling edge, in the callback, use HAL_GPIO_EXTI_Falling_Callback function instead of HAL_GPIO_EXTI_Callback as it's not the same API as in the STM32L4

You can check the available EXTI callbacks in stm32h5xx_hal_gpio.c, there are: 

* HAL_GPIO_EXTI_Falling_Callback

* HAL_GPIO_EXTI_Rising_Callback

* HAL_GPIO_EXTI_IRQHandler

This should work now!

 

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Sarra.S
ST Employee

Hello @username007

 

As you are configuring the PC13 as External Interrupt with Falling edge, in the callback, use HAL_GPIO_EXTI_Falling_Callback function instead of HAL_GPIO_EXTI_Callback as it's not the same API as in the STM32L4

You can check the available EXTI callbacks in stm32h5xx_hal_gpio.c, there are: 

* HAL_GPIO_EXTI_Falling_Callback

* HAL_GPIO_EXTI_Rising_Callback

* HAL_GPIO_EXTI_IRQHandler

This should work now!

 

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thank you!

P.S. I have no idea why it works NOW, but I tried that already and that didn't work before.