cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_GPIO_DeInit in STM32Cube_FW_F0_V1.9.0 issue

Klasson.Johannes
Associate II

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.

2 REPLIES 2
Imen.D
ST Employee

Hello,

Thank you for reported this issue.

This is raised internally for check and we will come back to you as soon as possible.

Kind Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Imen.D
ST Employee

Hello,

We confirm this issue which is already passed along to our development team for fix in the coming version of STM32CubeF0.

Thanks and Best Regards,

Imen.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen