Skip to main content
Klasson.Johannes
Associate
October 11, 2018
Question

HAL_GPIO_DeInit in STM32Cube_FW_F0_V1.9.0 issue

  • October 11, 2018
  • 2 replies
  • 1063 views

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.

This topic has been closed for replies.

2 replies

ST Technical Moderator
October 11, 2018

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
ST Technical Moderator
October 11, 2018

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.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks