STM32F7 HAL_EXTI_SetConfigLine() configures EXTI incorrectly.
The subsequent pair of the HAL_EXTI_GetConfigLine() and HAL_EXTI_SetConfigLine() configures EXTI incorrectly.
- CubeIDE 1.3.0
- F7 v1.16.0
The attached demonstration.zip contains a demonstration program of this program.
How to reproduce
Follow this step to reproduce the problem
- Import the project "d002-nucleo-f746-exti" to CubeIDE workspace.
- Build
- Run the built program on the Nucleo F746ZG board.
If you see both Blue and Red LED on, it is problematic.
Explanation of the demo program
This program is toggling Red and Blue LED alternately in the EXT call back routine. This EXTI interrupt is tied with the B1 button switch input ( EXTI 13 ).
Thus, it you must see red or blue LED for each time you push the B1 button switch on the Nucleo board.
But you can see both red and blue LED on. That mean, EXTI interrupt is raised continuously. This is not expected case.
The actual problem is inside the HAL_EXTI_SetConfigLine() API. In this program, this API is simply restores the saved EXTI configuration by preceding HAL_EXTI_GetConfigLine().
```
// Get the handle of the EXTI 13 ( B1 switch )
HAL_EXTI_GetHandle(&hexti_b1, EXTI_LINE_13);
// Save the configuration of the EXTI 13. This is set as edge interrupt, by initializer.
HAL_EXTI_GetConfigLine(
&hexti_b1,
&hexti_b1_config
);
// Clear the EXTI 13. Interrupt is disabled.
HAL_EXTI_ClearConfigLine(&hexti_b1);
// Restore the EXTI13 configuration. Now, it should be edge trigger.
HAL_EXTI_SetConfigLine(&hexti_b1, &hexti_b1_config);
```
Control experiment
You can import the d002-nucleo-g431rb-control project from the attached demonstration.zip to your work space. If you run this program on the Nucleo G431RB board, you will see the green LED blinks for each time you push the B1 button switch. This is expected behavior.
Please investigate and fix.
Takemasa
