cancel
Showing results for 
Search instead for 
Did you mean: 

EXTI15_10 not triggered by user button on NUCLEO-F429ZI

Fnx_QT
Associate III

Hello,

I'm trying to setup interrupts using the user push button (B1) on the Nucleo-F429ZI board. The push button is connected to the microcontroller through the I/O line PC13.

What I did is that I mapped the PC13 to the GPIO_EXTI15 in STM32CubeMX and enabled the NVIC interrupt for EXTI15_10. Then I regenerated the code which gave me the following function in main:

static void MX_GPIO_Init(void)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
 
  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOC_CLK_ENABLE();
 
  /*Configure GPIO pin : PC13 */
  GPIO_InitStruct.Pin = GPIO_PIN_13;
  GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
  /* EXTI interrupt init*/
  HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
 
}

I call it in the main after initializing the clocks. However, after the function has been executed, pressing the button does not trigger an interrupt. I enabled interrupt tracing and I can see that the interrupt is never triggered and my callback is therefor never called.

Did I do something wrong ? Thank you.

22 REPLIES 22

Yes they're enaled. HAL_Delay(10) is working and to be sure I use the __enable_irq() function.

Sarra.S
ST Employee

Did you try with other interrupts ? not with the push button but with another pin that you can set and reset

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.

Fnx_QT
Associate III

I finally found the problem... All the configuration was good, the only thing that broke my system was a preprocessor symbol define that was included in my example project : CMSIS_NVIC_VIRTUAL HSE_VALUE=8000000. I still don't know what purpose it serves.

In addition, the cmsis_nvic_virtual.h was used and some NVIC functions were redefined:

#define NVIC_SetPriorityGrouping    __NVIC_SetPriorityGrouping
#define NVIC_GetPriorityGrouping    __NVIC_GetPriorityGrouping
#define NVIC_EnableIRQ(IRQn)        svcNVIC_func(2U, IRQn)
#define NVIC_GetEnableIRQ           __NVIC_GetEnableIRQ
#define NVIC_DisableIRQ(IRQn)       svcNVIC_func(4U, IRQn)
#define NVIC_GetPendingIRQ          __NVIC_GetPendingIRQ
#define NVIC_SetPendingIRQ          __NVIC_SetPendingIRQ
#define NVIC_ClearPendingIRQ(IRQn)  svcNVIC_func(7U, IRQn)
#define NVIC_GetActive              __NVIC_GetActive
#define NVIC_SetPriority            __NVIC_SetPriority
#define NVIC_GetPriority            __NVIC_GetPriority
#define NVIC_SystemReset            __NVIC_SystemReset

Upon removing these two modifications, the button interrupt is now working correctly.

Thank you all for your help.