Timer 1 channel 1-4 Interrupt flags are set though the interrupts are not enabled
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2010-10-21 1:40 PM
Posted on October 21, 2010 at 22:40
Timer 1 channel 1-4 Interrupt flags are set though the interrupts are not enabled
This discussion is locked. Please start a new topic to ask your question.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:12 AM
Posted on May 17, 2011 at 14:12
Hi,
thanks for your answer. If that's the case, how would it be possible to find out which timer channel has caused the capture interrupt as there is only one interupt for four channels? best regards, JanOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:12 AM
Posted on May 17, 2011 at 14:12
Hi jan,
I remember, when I have used some examples of timers, that in timer interrupt handler you must check only on the interrupt pending bit you have enabled. Something like this: if(TIM_GetITStatus(TIM3, TIM_IT_CC2) == SET) { } Ciao, MCU LüfterOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:12 AM
Posted on May 17, 2011 at 14:12 Hi jan, In the timer status register (TIMx_SR) you can check the interrupt status. and each timer channel has an independent status flag. I am on line :) MCU Lüfter
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:12 AM
Posted on May 17, 2011 at 14:12
Hi,
that's what I expected based on the reference manual too. But when I check the TIM1_SR register in the interrupt routine, all 4 interrupt flags are set to 1 although I enabled only the interrupt for channel 1. I really appreciate your help. greets, JanOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:12 AM
Posted on May 17, 2011 at 14:12
Hi jang,
Check using the code below in timer interrupt handler. Just test the code and don't care about other capture flags. I have used the code below and it works fine in my own code. hope that helps. /* check if update flag is set */ if ((TIM1->SR & 0x00000001) != 0) { /* add your code about TIM1 update interrupt */ /* clear update flag: cleared by writing 0 */ TIM1->SR &= 0xFFFFFFFFE; } /* check if CC3 flag is set */ else if ((TIM1->SR & 0x00000008) !=0) { /* add your code relative to CC3 interrupt */ /* clear CC3 interrupt: cleared by writing 0 */ TIM1->SR & = 0xFFFFFFF7; } MCU Lüfter