cancel
Showing results for 
Search instead for 
Did you mean: 

Dear all, I use Cube Mx to generate code for good start and I made a project with STM32F745VETx. PD8 is set as EXTI8 and interrupt is activated. PE8 is defined as normal input.

TA1
Associate III

When I generate the code, Cube MX generates interrupt handler for EXTI9_5 and it is like that:

 /* USER CODE END EXTI9_5_IRQn 0 */

 HAL_GPIO_EXTI_IRQHandler(DIN2_Pin);

 /* USER CODE BEGIN EXTI9_5_IRQn 1 */

DIN2_Pin actually corresponds to PE8 and it is normal input not external interrupt source. I can easly workaround in this problem but I wonder it is mistake of Cube MX or it is normal? If it is mistake of Cube MX please correct it. If not please clarify me why PE8 send to IRQHandler instead of PD8 which is set to External interrupt source.

Thank you very much in advance.

Best Regards

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

Hello @TA,

This issue is fixed in STM32CubeMX latest release.

V6.5.0 is now available under this Link.

Thanks for your contribution.

Sara.

View solution in original post

6 REPLIES 6
SofLit
ST Employee

Dear @TA​ 

Just wanted to understand your issue.

You want to configure PE8 as normal input but CubeMx configures PD8 as external interrupt instead of PE8 as normal input, right?

SofLit

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.
TA1
Associate III

Dear Soflit

Let me clarify. PD8 is set as external interrupt source and PE8 is set as normal input. There isn't any problem with it. However Cube MX generates stm32f7xx_it.c file for interrupt handler and there is a mistake in that file.

PE8 and PD8 can be both set as EXTI8, but I set PD8 as EXTI8 and PE8 as input. Cube MX defined them in gpio.c file correctly. However Cube MX sends PE8 to EXTI_IRQHandler subroutine in stm32f7xx_it.c as follows:

void EXTI9_5_IRQHandler(void)

{

 /* USER CODE BEGIN EXTI9_5_IRQn 0 */

 /* USER CODE END EXTI9_5_IRQn 0 */

 HAL_GPIO_EXTI_IRQHandler(DIN2_Pin); //DIN2 corresponds to PE8

 /* USER CODE BEGIN EXTI9_5_IRQn 1 */

 /* USER CODE END EXTI9_5_IRQn 1 */

}

I expect that it should be as follows:

void EXTI9_5_IRQHandler(void)

{

 /* USER CODE BEGIN EXTI9_5_IRQn 0 */

 /* USER CODE END EXTI9_5_IRQn 0 */

 HAL_GPIO_EXTI_IRQHandler(DIN5_Pin); //DIN5 corresponds to PD8

 /* USER CODE BEGIN EXTI9_5_IRQn 1 */

 /* USER CODE END EXTI9_5_IRQn 1 */

}

I hope it is clear right now.

Regards

TA1
Associate III

Dear all,

Actually PE8 or PD8 it doesn't matter for IRQHandler because both of them defined as GPIO_PIN_8 in main.h file. So 

HAL_GPIO_EXTI_IRQHandler(DIN2_Pin);

or

 HAL_GPIO_EXTI_IRQHandler(DIN5_Pin);

do the same action and it is ok. However it causes confusing because DIN2 is not set as interrupt source. DIN2 is a normal input. If Cube MX generates the code as follows it would be better:

 HAL_GPIO_EXTI_IRQHandler(DIN5_Pin);

Regards

SofLit
ST Employee

Dear @TA​ ,

OK clear .. DIN2_Pin and DIN5_Pin both are defined as GPIO_PIN_8 which will not introduce an issue in your firmware but it's confusing in a code review.

@Sara BEN HADJ YAHYA​ ,

Could you please report this issue and fix it?

SofLit

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.
Sara BEN HADJ YAHYA
ST Employee

Hello @TA​ ,

Thanks for your feedback,

This is a known issue and already raised to the dev team. For more details, please check my answer in this thread CubeIDE incorrectly generates the initial code of EXTI handlers: namely, it substitutes the wrong names with User Labels

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 @Community member​  for flagging this to us.

Sara.

Sara BEN HADJ YAHYA
ST Employee

Hello @TA,

This issue is fixed in STM32CubeMX latest release.

V6.5.0 is now available under this Link.

Thanks for your contribution.

Sara.