Problem with simple GPIO toggling using a timer
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-11-28 6:54 PM
Posted on November 29, 2015 at 03:54
I have a simple timer interrupt based GPIO toggling code to be tested on STM32F401 discovery board as shown in this link
. The problem is this code doesn't toggle the LED/GPIO. I set a breakpoint inside the timer handler and I observed it is only hit once (I clear the interrupt flag in ISR) and then the whole program is trapped in the while loop of the main function. Could anyone suggest what can be wrong? Thanks. #gpio #led
Labels:
- Labels:
-
GPIO-EXTI
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-11-29 10:08 AM
Posted on November 29, 2015 at 19:08
Problem solved by replacing ISR
void
TIM2_IRQHandler(
void
)
{
if
(TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)
{
TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
GPIO_ToggleBits(GPIOD, GPIO_Pin_13);
}
}
with
void
TIM2_IRQHandler(
void
)
{
if
(TIM_GetITStatus(TIM2, TIM_IT_Update) == SET)
{
TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
GPIO_ToggleBits(GPIOD, GPIO_Pin_13);
}
}
Although I still don't see why those two are different.
