We are trying to use Application Watchdog, even though we can active the watchdog, when we try to deactivate or rearm the Watchdog timer, watchdog reset occurs:
I don’t think that this issue is about the Timer, I have used timers just like this without any problem. But I agree you on fixing these workarounds so I updated the code to this:
This code still resets the Application just after the “Rearming” Trace in WDTimer. So this issue looks like it’s about the adl_wdRearmAppWd() function.
I also wanted to ask if there is a limit for the count of timers on an application.
Now I don’t know how to fix this problem… Try to increase stack size, remove trace after watchdog rearming, check whether your watchdog facility is activated with WCFM command.
I also tried the Appli_WD sample provided with Developer Studio and it is working so it’s also not an hardware issue. Regarding the stack size, how do we define the stack size? What is the optimal value?
There’s plenty of stack setting in the examples e.g.
const u16 wm_apmCustomStackSize = 1024*3;
Optimal size? Depends on how limited you are in RAM. Just try increasing it and see if it helps, if not put it back to the normal.
Which system are you unsing this on? The WD is enabled by default in my setups, I have to switch it off for a few operations I do, but this is on a time-out, it then restarts.
Since your code works on a clean project you should add your existing code part by part and see when and where it starts crashing. It still could be a stack size issue - your stack is big enough for a small code size in a clean project, but small for your final code.
How to increase your stack size: if you are using developer studio, open generated.c in your project, set your application settings to writable, set stack size to 16536, rebuild your project. Also try to set ISR stack sizes to 1024.
If you are not using DS - read forum for instructions.
It is a good way to divide code on parts and modules which can be included or excluded independently. It is just an advise for a future refactoring.
It may work or not. I think it should work if placed just after including adl_global.h. But to avoid problems your better install newest developer studio, create new project and port your application in it. You will have new application settings in it.
Application was working with 1024 when it was Visual Studio project with old SDK. Since M2M studio reserved stack size is actually 3 times smaller than it is supposed by programmer. Well it is enough to set your stack size to 4096 by my application was crashing on this setting… But worked well on 81024 and 161024 (and actually on 3*1024).
Watchdog feature is provided with new SDK, so it is better to use new application settings with it.
With developer studio you will find how to do it easily.