cancel
Showing results for 
Search instead for 
Did you mean: 

Warning! HAL_GPIO_DeInit in STM32Cube_FW_F4_V1.4.0 work incorrect

Denis Krasutski
Associate III
Posted on February 16, 2015 at 09:50

Hello,

I have following problem, when I deinited PB4, using HAL_GPIO_DeInit function I lose the interrupt on PA4 pin.

Reason:  resetting SYSCFG->EXTICR[] values without checking port sources!

LIbs: STM32Cube_FW_F4_V1.4.0

#hal_gpio_deinit #cube
1 REPLY 1
Posted on February 19, 2015 at 19:02

Hikrasutski.denis,

Please find below the change you need to apply to make this function work properly :

/*------------------------- EXTI Mode Configuration --------------------*/
/* Configure the External Interrupt or event for the current IO */
tmp = SYSCFG->EXTICR[position >> 2];
tmp &= (((uint32_t)0x0F) << (4 * (position & 0x03)));
if(tmp == (GET_GPIO_INDEX(GPIOx) << (4 * (position & 0x03))))
{
tmp = ((uint32_t)0x0F) << (4 * (position & 0x03));
SYSCFG->EXTICR[position >> 2] &= ~tmp;
/* Clear EXTI line configuration */
EXTI->IMR &= ~((uint32_t)iocurrent);
EXTI->EMR &= ~((uint32_t)iocurrent);
/* Clear Rising Falling edge configuration */
EXTI->RTSR &= ~((uint32_t)iocurrent);
EXTI->FTSR &= ~((uint32_t)iocurrent);
}

We are aware of this limitation, and have already listed within the STM32Cube HAL bugs tracker, and it will be fixed in next releases of F4. Thanks for the report. Regards, Heisenberg.