How to access RTC interrupt, if possible?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
manusharian
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hello,

   

I have a RTC module that is working as default( just drag and drop in the creator). In order for the RTC to work I have attached the Timer2 WDT2 for RTC_sel clock, and set a period of x s. The RTC works fine and it wakes up the CPU every x seconds as intended. Because in my design I also included a BLE component there are many cases in which the CPU is waken up by the BLE events and the RTC is somehow in background. What I want is to know where is the interrupt of the RTC in order to set a flag only when the RTC timer expires in order to make some processing only at certain intervals of time.

   

I am unable to find that interrupt if any so I want to ask you if someone know this information? Notice that I may use another timer instead of the RTC but I need it in order to wake up the CPU from deep sleep and other timers cannot do this. I know that the RTC_Update function is called when the Timer2WDT expires but I do not know where.   

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You have two choices selectable in the clock window: Automatic WDT interrupt (which is used by the RTC) or manual WDT interrupt which will mean you will have to call RTC_Update() yourself from within the handler.

   

 

   

Bob

View solution in original post

0 Likes
10 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You have two choices selectable in the clock window: Automatic WDT interrupt (which is used by the RTC) or manual WDT interrupt which will mean you will have to call RTC_Update() yourself from within the handler.

   

 

   

Bob

0 Likes
manusharian
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hello Bob,

   

When I select the Manual WDT interrupt a warning appear that states: For using RTC along with WDT interrupt, 'Auto generated' should be selected.

   

Is there any other option or I should ignore that warning an proceed further? By the way do you have an example of how to implement the WDT interrupt by my self? Also this approach will still wakes the processor up every x s time?

   

 

   

Thanks!

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

There is a component: Global Signal Reference under the "System" components. Detailed description of WDT in the "System Reference Guide" (from Creator "Help" menu)

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Attached project is untested.

0 Likes
manusharian
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hi Bob,

   

Thanks for the example but unfortunately as I observed the Global Signal with WDT interrupt is not able to wake up the chip from Deep sleep. This is strange since the RTC in auto generated interrupt mode is able to do so. I do not need the RTC mandatory I only need a source to wake up the chip from deep sleep. According with the APP notes I found the WDT interrupt should be able to wake up the chip but I do not know why it is not.

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Complete, tested project.

   

When using a different board than the -044 M you will have to adjust the LED pin.

   

 

   

Bob

0 Likes
manusharian
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hello Bob,

   

Thanks for the example it worked as expected. The only drawback it has is the fact that the WDT is a 16 bit counter and it will wake up the CPU every 1 second in your example, instead of once at more seconds but as long as we have the BLE I do believe that the BLE will wake up the CPU more frequently thus making a reasonable solution in this moment. For RTC is a better way to use the WDT timer 2 but as I believe it is impossible to access the automatic interrupt.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You are quite free with the 3 WDC timers, you can even combine two of them to form a wider counter, see the documentation in the system reference guide.

   

 

   

Bob

0 Likes
manusharian
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hello Bob,

   

Ok I will read more about that. I tried to use WDT Timer 2 by changing the constants in your example and putting Timer 2 ones instead of timer 0 but nothing happened. I will read more about.

   

Another solution I have found was to delete the Global Signals and let the RTC to be driven by a Timer 2 WDT with an automatic interrupt. Then in main code I have checked the time parameter of RTC against an old RTC time value and if the difference between them exceeds an amount then I process. In this why the CPU is waken up once at X seconds.

   

Thanks very much for your help in this thread.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You are always welcome!

   

 

   

Bob

0 Likes