File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ extern "C"
37
37
void SystemClock_Config (void );
38
38
}
39
39
40
+ #include < IWatchdog.h>
41
+
40
42
#include " SPI.h"
41
43
#include < SerialEncoder.h>
42
44
#include " packet_processor.h"
@@ -496,6 +498,9 @@ void setup()
496
498
{
497
499
SystemClock_Config ();
498
500
501
+ // Initialize the IWDG with 4 seconds timeout. This would cause a CPU reset if the IWDG timer is not reloaded in approximately 4 seconds.
502
+ IWatchdog.begin (4000000 );
503
+
499
504
configurePins ();
500
505
DisableThermistorPower ();
501
506
@@ -967,10 +972,12 @@ void ServiceSerialPort()
967
972
}
968
973
}
969
974
970
-
971
975
void loop ()
972
976
{
973
977
978
+ // make sure the code in this loop is executed in less than 2 seconds to leave 50% headroom for the timer reload.
979
+ IWatchdog.reload ();
980
+
974
981
// Temperature sensor readings...
975
982
EnableThermistorPower ();
976
983
TakeExternalTempMeasurements (celldata);
@@ -1079,5 +1086,4 @@ void loop()
1079
1086
delay (2 );
1080
1087
countdown--;
1081
1088
}
1082
-
1083
1089
}
You can’t perform that action at this time.
0 commit comments