Problem with external GPIO interrupts on STM32G030K8.
Configuration Info:
MCU : STM32G030K8
STM HAL Dirve Version : 01.03.00.00
PA4 (GPIO_PIN_4) - Configured to generate interrupt upon detecting a falling edge.
PB5 (GPIO_PIN_5) - Configured to generate interrupt upon detecting a falling edge and rising edge.
External interrupt on PA4 and PB5 belong to group interrupt EXTI4_15_IRQn.
All the other gpio's are either configured to be input or output.
Function Execution Info:
1. Disable interrupt using the API HAL_NVIC_DisableIRQ(EXTI4_15_IRQn).
2. Request manual measurement from a sensor, sensor will pull PA4 pin low once data is ready.
3. Read data and store it. Clear interrupts from sensor side by writing to speific to its registers of sensor.
4. Clear interrupts before enabling them again, using this API __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_4).
5. Enable interrupt again using the API HAL_NVIC_EnableIRQ(EXTI4_15_IRQn).
Problem:
After performing #1 to #5 as mentioned above, we see that interrupt handler is invoked by MCU as soon as #5 is executed. This is an undesirable behavior.
At step #3, as soon as we read data from sensor, we are clearing interrupt register is sensor and the PA4 goes high again immediately.
Also, there is no activity on PB5 when this action is performed.
Expected behavior is that, MCU should not invoke interrupt handler since we have made sure to disable interrupt at #1. We suspect this API HAL_NVIC_DisableIRQ(EXTI4_15_IRQn) is not working as expected.
Kindly suggest an alternative for this API or any other inputs will be much appreciated.
