2022-01-17 03:40 AM
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
Solved! Go to Solution.
2022-03-07 11:20 PM
2022-01-17 03:55 AM
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
2022-01-17 05:41 AM
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
2022-01-17 06:02 AM
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
2022-01-17 06:12 AM
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
2022-01-17 06:50 AM
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.
2022-03-07 11:20 PM