cancel
Showing results for 
Search instead for 
Did you mean: 

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

AFinn.1
Associate II
1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

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.

View solution in original post

9 REPLIES 9
AFinn.1
Associate II

How to fix that?

Thanks

AFinn.1
Associate II

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 Employee

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.

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

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
Associate

Tank you, Peter.

Regards, Boguslaw

Hello All,

Thanks for bringing this issue to our attention.

I added @Sara BEN HADJ YAHYA​  from CubeMx team for review.

Thanks

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Sara BEN HADJ YAHYA
ST Employee

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.

Sara BEN HADJ YAHYA
ST Employee

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.