- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to set up a periodic interrupt using the Timer 2.7 module. But I see that the interrupt is only triggered once ever.
I tried the same setup with the TCPWM module, and the periodic interrupt works fine.
The only difference in firmware that I see is the clearing of interrupt flag with TCPWM implementation. But Timer's datasheet says that interrupt is cleared automatically with this module, and there is no software interface to clear the interrupt either.
Could anyone give me an idea why the Timer module is not working the way I expect it to?
Edit 1: Update with Workspace Bundle as requested.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I must have changed the Timer mode to "One-shot (halt on interrupt)" while tweaking things around figuring out why the initial setup did not work. I meant to use Continuous. Sorry about that.
Regarding the having to read the Status Register, I admit only wentthrough the datasheet anywhere it says "Interrupt." It never occurred to me that the interrupt is tied to the TC flag, which being cleared requires reading the Status Register.
It works now. Thank you,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome in the forum!
Can you please post your complete project (that one that doesn't work as expected), so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I upload the project, Bob. I forgot to make a minimal bundle and made a complete one.. I hope that is not a big issue since the bundle is only 2MB even after all that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tested you project and suggest the following changes:
1) Change the 'Run mode' to 'Continuous'. In the project attached, it is 'One Shot(halt on Interrupt)'.
2) Include this line in the ISR:
TIMER1_STATUS;
This basically reads the status register of the Timer. If you read the datasheet carefully, you will see that the interrupt on TC is "sticky". So you have to read the Status register in order to clear the sticky Terminal Count (TC) bit in the status register.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I must have changed the Timer mode to "One-shot (halt on interrupt)" while tweaking things around figuring out why the initial setup did not work. I meant to use Continuous. Sorry about that.
Regarding the having to read the Status Register, I admit only wentthrough the datasheet anywhere it says "Interrupt." It never occurred to me that the interrupt is tied to the TC flag, which being cleared requires reading the Status Register.
It works now. Thank you,