You are here

Timer Continuous TC Interrupt only triggered once | Cypress Semiconductor

Timer Continuous TC Interrupt only triggered once

Summary: 4 Replies, Latest post by htvo3_1410116 on 09 Oct 2016 08:31 PM PDT
Verified Answers: 1
Last post
Log in to post new comments.
htvo3_1410116's picture
User
5 posts

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.

 

user_1377889's picture
User
9622 posts

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

 

htvo3_1410116's picture
User
5 posts

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.

yssu's picture
Cypress Employee
22 posts

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.

htvo3_1410116's picture
User
5 posts

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,

Log in to post new comments.