Enable Hardware Watchdog

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
apica
Posts: 15
Joined: 19 Oct 2017 12:46

Enable Hardware Watchdog

Post by apica »

Hello,

I'd like to enable the internal Watchdog. I saw an viewtopic.php?f=3427&t=25195 but it's not available in the last release (2.1.1), and I need an urgent solution.

How can I enable the watchdog? Which commands (and how) are needed?

Thank you.
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Enable Hardware Watchdog

Post by PoltoS »

Why do you need it? Does your Z-Uno hangs? Internal WatchDog is pretty tricky - you can not configure it's grace period, so you might have problems with even on valid sketches. Better to solve the problem that causes the hang
apica
Posts: 15
Joined: 19 Oct 2017 12:46

Re: Enable Hardware Watchdog

Post by apica »

Thank you for your reply.

Yes, it hangs after a while. There is a problem when i read with ADC (analogRead) after a while. I found that moving all local variables (just few uint16_t) to a global scope and merging code (to avoid entering to a functions and increasing stack), the problem is solved. But this solution doesn't give me very confidence because it seems to be related to an internal issue.
petergebruers
Posts: 255
Joined: 26 Jul 2015 17:29

Re: Enable Hardware Watchdog

Post by petergebruers »

@apica, have you tried 2.1.1 yet? I can recommend it, it contains a lot of improvements. And if it does not, I offer you a helping hand, ... Please let me know what you think...
petergebruers
Posts: 255
Joined: 26 Jul 2015 17:29

Re: Enable Hardware Watchdog

Post by petergebruers »

Forgot something important... there is an issue with that version on windows, if your user directory has a space in its path...
apica
Posts: 15
Joined: 19 Oct 2017 12:46

Re: Enable Hardware Watchdog

Post by apica »

Yes!

I'm using the 2.1.1 from yesterday (I had the same problem with 2.1.0).
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Enable Hardware Watchdog

Post by PoltoS »

We can try to investigate your issue if you provide the sketch and a way to reproduce the problem
apica
Posts: 15
Joined: 19 Oct 2017 12:46

Re: Enable Hardware Watchdog

Post by apica »

@PoltoS, I've send you a private message with the sketch. I prefer to not make it public for the moment.

Thank you
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Enable Hardware Watchdog

Post by PoltoS »

We have cheked your sketch. Clearly, it overflows the stack. You can check this in the debug output once enabled in the ArduinoIDE.

We suggest to use less float (don't multiply by g and then device back). Try to minimized numbers of nested functions and make more glabal variables and/or make them smaller size.

Code: Select all

0056:A0 00...
Period Average = 6.89
Send report
ADC: 779   Bat: 3089.87   V: 2352   R: 313   F: 66.11   W: 6.74
0056:A0 00
ADC: 785   Bat: 3089.87   V: 2370   R: 303   F: 68.08   W: 6.94
ADC: 779   Bat: 3089.87   V: 2352   R: 313   F: 66.11   W: 6.74
ADC: 786   Bat: 3089.87   V: 2373   R: 301   F: 68.47   W: 6.98
Note the

Code: Select all

A0 00
check it agains this table: https://github.com/Z-Wave-Me/Z-Uno-Core ... ons.h#L130
apica
Posts: 15
Joined: 19 Oct 2017 12:46

Re: Enable Hardware Watchdog

Post by apica »

Thank you @PoltoS.

I've tried enabling the output Log on UART0, but it didn't appeared (I'll check it again) -> EDIT: I didn't know about that codes and the meaing! Thank you!

The stack usage shouldn't be that high (the same code runs in all arduino boards I tried). How big is the stack? Any way to determine/estimate the stack used?

Thank you
Post Reply