program stuck after few hours

Hello,

I am facing a strange phenomenon:

My program (ver.30) runs ok, i'll call it "good state" ~ 1-9, hours and then get stuck and become in "broken state".

In good state, the machine runs the code as expected and (repeatedly) reacts as expected to cycling the power or pressing the reset (or ^M if IDE attached): program starts and runs.

In "broken state" after reset/power cycling, the machine (repeatedly) starts the setup() and get stuck at the function udp.begin.packet as if the code got corrupted(!) and only reloading will get it back to the "good state" for some hours.

code attached

Many thanks in advance for any suggestion

_30.zip (20.2 KB)

Use the F() macro and the _P variants of functions like "strcat_P" more.

Compiler's output

In file included from _30.ino:10:0:
C:\Users\Guy\Documents\Arduino\libraries\icmp_ping/ICMPPing.h:37:1: warning: 'typedef' was ignored in this declaration [enabled by default]
};
^
In file included from _30.ino:13:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:43:30: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
operator const uint8_t() const { return **this; }
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:92:26: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
operator const int() const { return index; }
^

Sketch uses 42,796 bytes (16%) of program storage space. Maximum is 253,952 bytes.
Global variables use 5,104 bytes (62%) of dynamic memory, leaving 3,088 bytes for local variables. Maximum is 8,192 bytes.

Thanks Awol - was not aware of strcat_P

Does someone know how to compare the flash with the compiled code?

It's a bit beyond me. DHCP timing out?

Does someone know how to compare the flash with the compiled code?

The avrdude function does that as it uploads the hex file. Any discrepancies are reported.

1 - 9 hours? Are you looking at milis(); somewhere and not properly accounting for rollover?

-jim lee

millis rollovers are every seven weeks, not nine hours.
micros rollovers are less than two hours.

Rollovers are shorter if the wrong data types are used, but that would be silly.

jimLee:
1 - 9 hours? Are you looking at milis(); somewhere and not properly accounting for rollover?

-jim lee

Thanks,
I am looking at my watch

PaulS:
The avrdude function does that as it uploads the hex file. Any discrepancies are reported.

Thanks, I opened a new tread just for this question and had the same answer you gave. I will look into it closely and report my finding in the two thread. Amazingly previous version, 29 with some extra lines of debug code is now running 4 days(!) Version 30 must be haunted

Hello,

I tried the read back and compare procedure -unsuccessfully-
If you are interested and can help, please continue to this thread

Thanks for sharing your expertise

Below are the errors I found and corrected in the above sketch. The code runs ok now and hopefully contains no other errors.

Line 992 redefines global vector phantLog
Line 1604 incompatible with Line 1082 and 948

And yes, flash has been corrupted by the erratic program, in the link of previous post the discussion on tools for flash integrity assessment