Skip to main content
AFinn.1
Associate II
December 9, 2021
Solved

CubeIDE incorrectly generates the initial code of EXTI handlers: namely, it substitutes the wrong names with User Labels

  • December 9, 2021
  • 9 replies
  • 4660 views

0693W00000Ho0J6QAJ.png

This topic has been closed for replies.
Best answer by Sara BEN HADJ YAHYA

Hello @AFinn.1​ ,

Thanks for your feedback,

This issue was already detected with other STM32 and raised to the development team. I'll keep you posted with the updates.

** Taking the example of PC6 and PA6, both pins CAN be configured as GPIO_EXTI6 **

  • PC6 configured as a GPIO_EXTI6, user Label EXTI_PC6 and interrupt enabled in NVIC settings
  • PA6 configured as an Output, user label Output_PA6

 In EXTI9_5_IRQHandler(), user will find the following HAL_GPIO_EXTI_IRQHandler(Output_PA6_Pin) instead of HAL_GPIO_EXTI_IRQHandler(EXTI_PC6_Pin);

Workaround :

Either remove PA6 user label or set its state to reset state, this will give you a correct generated code.

Sorry for any inconvenience that this may cause.

If you issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Thanks @Imen DAHMEN​ and @Peter BENSCH​  for flagging this to us.

Sara.

9 replies

AFinn.1
AFinn.1Author
Associate II
December 9, 2021

How to fix that?

Thanks

AFinn.1
AFinn.1Author
Associate II
December 9, 2021

CubeIDE generates the source code of EXTI handlers incorrectly: inserts the wrong names into the HAL_GPIO_EXTI_IRQHandler () handler with custom labels

Peter BENSCH
ST Technical Moderator
December 9, 2021

Welcome, @AFinn.1​, to the community!

You have marked GPIO_PIN_6 in the third and fourth screenshots, but they each belong to different GPIO ports:

  • ADC2_nRESET = PA6
  • CS = PC6

This is also listed in the lines below that defines the GPIO port:

  • ADC2_nRESET_GPIO_Port GPIOA
  • CS_GPIO_Port GPIOC

Regards

/Peter

In order 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.
BKubr.1
Visitor II
January 7, 2022

Hello, in my opinion this is an issue. If you define two User Labels (in my case analog input PA1 as ABC and EXTI PB1 as DEF) configuration tool will generate automatically in main.h:

#define ABC_Pin GPIO_PIN_1

#define ABC_GPIO_Port GPIOA

.

#define DEF_Pin GPIO_PIN_1

#define DEF_GPIO_Port GPIOB

..

than in stm32f1xx_it.c configuration tool will use incorrect User Label automatically generating interrupt handler

void EXTI1_IRQHandler(void)

{

 /* USER CODE BEGIN EXTI1_IRQn 0 */

 /* USER CODE END EXTI1_IRQn 0 */

 HAL_GPIO_EXTI_IRQHandler(ABC_Pin); <------------in my opinion should be DEF_Pin

 /* USER CODE BEGIN EXTI1_IRQn 1 */

 /* USER CODE END EXTI1_IRQn 1 */

}

I know, that finally that both ABC_Pin and DEF_Pin have same value, but it is a little bit frustrating

Best Regards, Boguslaw

Peter BENSCH
ST Technical Moderator
January 10, 2022

Thanks, Boguslaw, that's indeed a bug and will be transferred to the CubeMX team.

Regards

/Peter

@Imen DAHMEN​ It is easy to recreate: PA1=ADCx, PB1=GPIO_EXTI1, NVIC=ENBL EXTI -- generates exactly the code shown by Bogulaw for EXTI (confirmed with several STM32).

In order 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.
BKubr.1
Visitor II
January 10, 2022

Tank you, Peter.

Regards, Boguslaw

Sara BEN HADJ YAHYA
ST Technical Moderator
January 13, 2022

Hello @AFinn.1​ ,

Thanks for your feedback,

This issue was already detected with other STM32 and raised to the development team. I'll keep you posted with the updates.

** Taking the example of PC6 and PA6, both pins CAN be configured as GPIO_EXTI6 **

  • PC6 configured as a GPIO_EXTI6, user Label EXTI_PC6 and interrupt enabled in NVIC settings
  • PA6 configured as an Output, user label Output_PA6

 In EXTI9_5_IRQHandler(), user will find the following HAL_GPIO_EXTI_IRQHandler(Output_PA6_Pin) instead of HAL_GPIO_EXTI_IRQHandler(EXTI_PC6_Pin);

Workaround :

Either remove PA6 user label or set its state to reset state, this will give you a correct generated code.

Sorry for any inconvenience that this may cause.

If you issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Thanks @Imen DAHMEN​ and @Peter BENSCH​  for flagging this to us.

Sara.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
Sara BEN HADJ YAHYA
ST Technical Moderator
March 8, 2022

Hello  @AFinn.1,

This issue is fixed in STM32CubeMX latest release.

V6.5.0 is now available under this Link.

Thanks for your contribution.

Sara.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.