SYS vs DEV trace on watchdog


I am having problems with device resetting by watchdog. Device, having my app loaded, perodically resets with trace ‘DEV, Watch dog reset. Tsk 12’.

It seems to occur nondeterministically, but seems somehow connected to reestablishing(teardown and reconnect) a WIP TCP connection.

However, when I provoke reset with while(true);, the resetting trace is ‘SYS. Watch dog reset. Tsk 31’. From that, I imply that it is not my application that is at fault and looping somewhere.

Backtraces get decoded, in both cases, as

  • that’s understandable, as it’s watchdog reset.

While it’s quite possible that it is my application that is hanging the module(I am still trying to locate it), one thing that wonders me is the difference between DEV-traced watchdog resets and SYS-traces ones. What’s the difference?

Try increasing stack size?

Also check for any pointers that might have been left “dangling” after the “teardown”…

Thank you for your assistance.

As I use pointers sparingly and prefer to use global variables to store state, I found no dangling pointers after teardown proceeded.

Watch dog errors(tsk 12) persist after increasing stack size from 32K to 64K and rewriting application to use malloc() more instead of local buffers.

Additionally, new error appeared:
NULL pointer called by function at 0x000034E1

Which puzzles me, as applications are linked at 0x00260000.


Check loops. If your application is waiting for something in the loop, you will get watchdog reset.
For example, instead of waiting in the loop, set up timer and check the condition from timer handler.

Watchdog happens if OpenAT is not getting control periodically, e.q. your application takes too much time.


I wouldn’t waste your time here if I hadn’t checked all of my loops at least 10 times. So far, this 2000+ line app is using state machine paradigm very successfully.

I’ll let them go. They appear unfrequently enough that they may be tolerated. However, I’ve started encountering another type of unnerving bugs, but that’s for another topic.

How can we decide what custom stack size should be? I think on the documantation there is no explanation of custom stack size about what its value should be.
Sorry henrietta, this is not so related to your question.

It can’t hurt, especially if stack overflows are not handled gracefully by Open AT. When you got a megabyte of RAM, you have no reason to be shy :slight_smile:, especially that maximum stack size is AFAIK 64 kB.