AnsweredAssumed Answered

STM32F103c8t6 external interrupt  issue

Question asked by sak hos on Aug 21, 2017
Latest reply on Aug 21, 2017 by waclawek.jan

hello,
i'm facing a strange issue, i'm using STM32F103c8t6 and i'm trying to use external interrupt (please take a look the configuration below), the issue is when i trigger the interruption only one time, the callback(HAL_GPIO_EXTI_Callback) is called twice in a row
does anyone have an idea about this
thank you

/*******************************************************************/

void MX_GPIO_Init(void)
{

GPIO_InitTypeDef GPIO_InitStruct;

/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();

/*Configure GPIO pin : PA1 */
GPIO_InitStruct.Pin = GPIO_PIN_1;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;//GPIO_MODE_IT_RISING_FALLING;//GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;//GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/*Configure GPIO pins : PB0 PB12 PB15 PB5
PB6 PB7 PB8 PB9 */
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_12|GPIO_PIN_15|GPIO_PIN_5
|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull =GPIO_PULLDOWN; //GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI0_IRQn);

HAL_NVIC_SetPriority(EXTI1_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI1_IRQn);

HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);

HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);

}

/********************************************************************************/

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
switch (GPIO_Pin)
{
case GPIO_PIN_0:/*BEGIN_END_OF_COMPETITION*/
MessageToBSent.Command=BEGIN_END_OF_COMPETITION;
MessageToBSent.DestinationAddress=BROADCAST_ADDRESS;
Send_Command_To_Modules (&MessageToBSent);
break;

case GPIO_PIN_1:/*START_COMPETITION or STOP_COMPETITION*/
if (StartStopCompetitionButtonLastValue==STOP_COMPETITION)

{
MessageToBSent.Command=START_COMPETITION;
MessageToBSent.DestinationAddress=TIMER_MODULE_ADDRESS;
Send_Command_To_Modules (&MessageToBSent);
StartStopCompetitionButtonLastValue=START_COMPETITION;
break;
}

}

}

Outcomes