2015-10-03 03:20 PM
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 worksvoid 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
2015-10-03 05:11 PM
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.