2015-01-26 01:56 AM
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
2015-02-02 11:24 PM
Hi,
My fault, I have checked the options on STMCubeMX ''Show only Interrupt Enabled''The same functions are generated by tool.