cancel
Showing results for 
Search instead for 
Did you mean: 

Bug: CubeMX generated code does use EXTI RegisterCallback when set in .ioc

JulianHartmer
Associate

Setup:

  • STM32CubeMX Version v6.14.0
  • SMT32Cube FW_G4 V1.16.0

Problem Description:
When enabling RegisterCallback for EXTI Interrupts, the generated code still calls a predefined interrupt callback  for EXTI interrupts and does not call the registered callback function.

/**
  * @brief  Handle EXTI interrupt request.
  * @PAram  GPIO_Pin Specifies the port pin connected to corresponding EXTI line.
  * @retval None
  */
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
{
  /* EXTI line interrupt detected */
  if (__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != 0x00u)
  {
    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
    HAL_GPIO_EXTI_Callback(GPIO_Pin);
  }
}

/**
  * @brief  EXTI line detection callback.
  * @PAram  GPIO_Pin: Specifies the port pin connected to corresponding EXTI line.
  * @retval None
  */
__weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  /* Prevent unused argument(s) compilation warning */
  UNUSED(GPIO_Pin);

  /* NOTE: This function should not be modified, when the callback is needed,
           the HAL_GPIO_EXTI_Callback could be implemented in the user file
   */
}

The generated code sets the correct #define value, but the define value is not referenced anywhere in the code.

#define USE_HAL_EXTI_REGISTER_CALLBACKS       1U

JulianHartmer_1-1751374607168.png

 

Expected: The interrupt calls the registered callback function instead.



How to reproduce:

  • Enable EXTI Register Callback:

JulianHartmer_0-1751374472461.png

  • Set a GPIO to trigger an interrupt:

JulianHartmer_2-1751375439836.png

 

  • Enable interrupt for the GPIOs EXTI line

JulianHartmer_3-1751375484787.png

 

  • Generate Code
  • The generated interrupt handler does not call the registered interrupt. Instead, it uses the normal interrupt function just as if RegisterCallback for EXTI is disabled.
3 REPLIES 3
Mahmoud Ben Romdhane
ST Employee

Hello @JulianHartmer ,

 

First let me thank you for posting and welcome to the ST Community.

For more investigation, I suggest that you provide your Ioc.File.

 

Thanks.

Mahmoud

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.

Hi Mahmoud,

 

here is a sample .ioc file that showcases the bug. The exti interrupt handler does not use the registered function. 

Hello @JulianHartmer ,

 

Further to your comment, let me thank you for bringing this issue to our attention.

The issue was reported and raised to the Development team under an internal ticket (Ticket Number : 213411) 

 

Thanks.

Mahmoud

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.