Questions and discussions about the software that runs on the TD RF module itself.
ramon2015
 
Posts: 51
Joined: Mon Jul 06, 2015 4:06 pm

User_loop service every 8,5 minutes

by ramon2015 Wed Aug 10, 2016 7:52 am

Hello,

I have sjust disceverd my user_loop is called each 8,5 minutes. I have not setup any timed interrupt.
Any idea why this is happening?

Regards, Ramon.
User avatar
mstempin
 
Posts: 168
Joined: Thu May 07, 2015 9:24 am

Re: User_loop service every 8,5 minutes

by mstempin Wed Aug 10, 2016 8:06 am

Actually, every 512 seconds (8'32"):.

This is not a bug, it is the RTC overflow IRQ that causes this. The RTC counter is clocked at 32.768 kHz (no prescaler for maximum resolution) and as it is held in a 24 bit register, it overflows every 2 ¨ 24 / 32768 = 512 seconds.

You can take this opportunity to increment a long term counter that will get incremented every 512 seconds. This is exactly what does the Sigfox stack to handle the 24 hour keepalive message sent to the network.
ramon2015
 
Posts: 51
Joined: Mon Jul 06, 2015 4:06 pm

Re: User_loop service every 8,5 minutes

by ramon2015 Thu Aug 11, 2016 4:59 pm

Thanks for the point. good to know.

I was testing the watchdog by using the following and the RTC overflow happened every 8 secs or so instead of every 8'32".

// Initialize a 16s watchdog
if (TD_WATCHDOG_Init(16)) {

tfp_printf("Watchdog started\r\n");
}
else
{
tfp_printf("Watchdog failed\r\n");
}

Is this normal?

I guess the WDT needs to be ticked before 16 sec lapse. and this is why it wakes up every 8 sec.

The system is supposed go deep sleep while not in the user_loop, right?
Is it going to the deepest sleep mode by default? or do we require to do sth spcecial?
The system is drawing like 1 mA !! while not in the user_loop.
Could you point me in the right direction where I can get detailed info/example of this?


Regards, Ramon.
ramon2015
 
Posts: 51
Joined: Mon Jul 06, 2015 4:06 pm

Re: User_loop service every 8,5 minutes

by ramon2015 Thu Aug 11, 2016 5:05 pm

I forgot to mention about the timed interrupts I am trying to set by using:

TD_SCHEDULER_Append(action1Period, 0, 0, TD_SCHEDULER_INFINITE, action1, 0);

or

TD_SCHEDULER_AppendIrq(5, 8192, 0, TD_SCHEDULER_INFINITE, action1, 0);

I think I can set timed interrupts with a very long interval (days, months).
Do you still recommend to use the RTC overflow and longterm counters on the user_loop?

Regards, Ramon.
User avatar
mstempin
 
Posts: 168
Joined: Thu May 07, 2015 9:24 am

Re: User_loop service every 8,5 minutes

by mstempin Tue Aug 16, 2016 8:19 am

The event you get is not the RTC overflow, it is the watchdog refresh event.

Regarding the watchdog, the given period is divided by 2 to make sure to meet the deadline: e.g. if you provide 16 s, the timer will trigger an interrupt every 8 s so it can be refreshed before the fatal 16 s.

When you do nothing and exit from TD_USER_Loop(), the system will go bac kto EM2 mode with just the LEUART and RTC running, with a power consumption of 1.3µA typical. I don't know what causes the power consumption you measure, can you try to measure using the standard AT firmware?

It is possible to use either the RTC overflow directly, or to use the TD_SCHEDULER. The last solution draws the TD_SCHEDULER in your firmware, which uses quite a bit of Flash memory because of its complexity. If you really need the complexity because you run many independent timers at the same time, it is the best solution. But if you only require a long timer and nothing more, the direct RTC solution is better.
ramon2015
 
Posts: 51
Joined: Mon Jul 06, 2015 4:06 pm

Re: User_loop service every 8,5 minutes

by ramon2015 Fri Sep 30, 2016 12:19 pm

Hi,

I would like to enable the WDT only while my user_loop is runnning and stop it before leaving user_loop. But it seems the disabling does not work (TD_WATCHDOG_Enable(false, true);)
the system keeps on feeding it because it wakes up every 8 sec. afetrwards

I call setup_WDG() at the beginig of user_loop and stop_WDG() is called at the end of user_loop.
Any advice. I have also tried manual feeeding but still keeps on waking up for feeding.

void setup_WDG()
{
// Initialize a 16s watchdog
if (TD_WATCHDOG_Init(16))
{
tfp_printf("Watchdog started\r\n");
}
else
{
tfp_printf("Watchdog failed\r\n");
}


// Start watchdog with automatic feed
TD_WATCHDOG_Enable(true, true);

// Start watchdog with manual feed
//TD_WATCHDOG_Enable(true, false);
}

void stop_WDG()
{
// Stop watchdog
TD_WATCHDOG_Enable(false, true);
tfp_printf("Watchdog disabled\r\n");
}
Return to Firmware

Who is online

Users browsing this forum: No registered users and 28 guests