cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX 4.6 - STM32F373 GPIO_EXTI issue?

enrico2
Associate
Posted on January 26, 2015 at 10:56

Hi all,

I'm trying to activate GPIO_EXT line with interrupt. But when I set some pins with this configuration by tool, no NVIC Interrupt are ''created'' for this functions. I need add manual code instm32f3xx_it.c like this:

void EXTI3_IRQHandler(void)
{
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3);
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_3);
}
void EXTI4_IRQHandler(void)
{
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4);
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_4);
}
void EXTI9_5_IRQHandler(void)
{
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_5);
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_6);
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_5);
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_6); 
}

In GPIO thi is the pin configurations:

[....]
/*Configure GPIO pins : PE3 PE4 PE5 */
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
[...]
/*Configure GPIO pin : PF6 */
GPIO_InitStruct.Pin = GPIO_PIN_6;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
[...]

I had add this code in GPIO.c for enable interrupt:

/* USER CODE BEGIN 2 */
void GPIO_EXTI_Wkup_EN(void)
{
/* CLEAR EXTI INTERRUPT FLAG */
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_3);
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_4);
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_5); 
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_6);
/* ENABLE EXTI INTERRUPT */
HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 3);
HAL_NVIC_EnableIRQ(EXTI3_IRQn);
HAL_NVIC_SetPriority(EXTI4_IRQn, 0, 3);
HAL_NVIC_EnableIRQ(EXTI4_IRQn);
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 3);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
}
/* USER CODE END 2 */
Code work, I only know if it's normat that Tool don't generate it.
Thanks you

1 REPLY 1
enrico2
Associate
Posted on February 03, 2015 at 08:24

Hi,

My fault, I have checked the options on STMCubeMX ''Show only Interrupt Enabled''

The same functions are generated by tool.