Wanted to introduce WDT on free RTOS running atmel SAMD20

hellomanas1991 wrote on Thursday, June 02, 2016:

Hi All,
I wanted to introduce WDT on atmel(RTOS running). I have tried with the WDT driver provided on Atmel IDE. It is working on basic project(Mean without RTOS). But when I am using the same driver on a project where RTOS is running just keep on resetting the system again and again.

rtel wrote on Thursday, June 02, 2016:

You don’t say why. I’m guessing, as this is a watchdog, that it is supposed to reset the system if it is not ‘kicked’. Are you kicking the watchdog in an attempt to prevent the watchdog resetting the system. If so, where from and under what circumstance?

hellomanas1991 wrote on Friday, June 03, 2016:

Thanks for the reply !
I have a WDT which I configured for 15 sec reset time if it is not being kicked with in that time period.But the problem is that in case of RTOS after initializing all the tasks and just before the schedular starts when I am initializing the WDT. It is not waiting till the expiry time. Immediately it is resetting the system.So I am thinking it is doing something with the free RTOS Ticks count/timer tick.

rtel wrote on Friday, June 03, 2016:

Do you mean the system resets before the scheduler has even started? If
so, are you sure it is the WDT that is resetting the system - seems
unlikely if it is set for 15 seconds.

Is the driver for the watchdog timer enabling interrupts using the
basepri register? If so, that could cause a problem just before the
scheduler starts.

Have you tried enabling the watchdog after the scheduler has started?
Perhaps in the Daemon Task Startup Hook, if you are using timers
(http://www.freertos.org/a00016.html) - or maybe even in a one shot timer.

hs2sf wrote on Saturday, June 04, 2016:

I’m using the SAM1B WDT w/o any problems. Except a periodic refresh task (as 1 possibility) it’s completely unrelated to the RTOS. Although I’m not uing a ‘driver’ for the rather simple WDT setup I guess, the Atmel driver only touches WDT resoures.
You should double check you WDT setup.

hellomanas1991 wrote on Sunday, June 12, 2016:

Thank you so much for your support ! I have resolved this issue by implementing the above solution you provided.