HAL_GPIO_DeInit in STM32Cube_FW_F0_V1.9.0 issue
I have a 32 kHz LSE clock as output on the MCO on GPIO PA[8]. In my program I go to stop mode with wake up interrupt on several GPIOs, on of them are PC[8]. When I wake up again I don't wan't interrupt on these GPIOs and run HAL_GPIO_DeInit on them (the MCO still active). This will cause the microcontroller to get spammed with interrupts and get stuck in GPIO_EXTI_Callback.
Looking at HAL_GPIO_DeInit it contains the code:
/* Clear external interrupt configuration register */
tmp = (0x0FU) << (4U * (position & 0x03U));
CLEAR_BIT(SYSCFG->EXTICR[position >> 2U], tmp);
/* Clear EXTI line configuration */
CLEAR_BIT(EXTI->IMR, (uint32_t)iocurrent);
CLEAR_BIT(EXTI->EMR, (uint32_t)iocurrent);
/* Clear Rising Falling edge configuration */
CLEAR_BIT(EXTI->RTSR, (uint32_t)iocurrent);
CLEAR_BIT(EXTI->FTSR, (uint32_t)iocurrent);It first clears the SYSCFG->EXTICR register before clearing the interrupt configuration. So when I run HAL_GPIO_DeInit(GPIOC,GPIO_PIN_8) it will clear the SYSCFG->EXTICR register, which when being 0 will select PA[8] as the source input for the EXTI8 external interrupt. As I still have MCO output on PA[8] this will instantly trigger interrupts and as I have rising and falling edge it will cause 64k interrupts per second. Apparently it can not handle interrupts this often as I get stuck in constant callbacks and never get to the point where the interrupt configuration is cleared.
