cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 F0 Discovery - interrupt question

irslabs
Associate
Posted on October 04, 2015 at 00:20

I am CubeFX and Keil. Hardware is Discovery board with STM32F051R8T6. Created an interrupt for PA0 (user button) and toggle an led (PC9 green LED).

This works

void EXTI0_1_IRQHandler(void) 
{ 
if(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0)) 
{ 
HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_9); 
} 
HAL_NVIC_ClearPendingIRQ(EXTI0_1_IRQn); 
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0); 
}

This does not work (only difference is the HAL_Delay(100) )

void EXTI0_1_IRQHandler(void) 
{ 
if(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0)) 
{ 
HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_9); 
HAL_Delay(100); 
} 
HAL_NVIC_ClearPendingIRQ(EXTI0_1_IRQn); 
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0); 
}

What I am doing wrong here? new to the ARM world. Thanks You! #interrupt #stm32f0 #discovery-f0
1 REPLY 1
Posted on October 04, 2015 at 02:11

Doesn't the HAL_Delay rely on the Systick interrupt working? If it's blocking in your interrupt, because of preemption, or M0 things, then it's not going to complete. Consider if a) you need to delay in the IRQ, b) if you can use some other free running timer to mark time.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..