Skip to content

Commit da70c88

Browse files
committed
tweak watchdog kick reset test
Change the value of KICK_ADVANCE_MS so targets pass the test in worst cases
1 parent 431c4c1 commit da70c88

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

TESTS/mbed_drivers/watchdog_reset/main.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,21 @@
2626
#include "mbed.h"
2727

2828
#define TIMEOUT_MS 100UL
29-
#define KICK_ADVANCE_MS 10UL
29+
30+
/* This value is used to calculate the time to kick the watchdog.
31+
* Given the watchdog timeout is set to TIMEOUT_MS, the kick will be performed
32+
* with a delay of (TIMEOUT_MS - KICK_ADVANCE_MS), after the init.
33+
*
34+
* It is common for the watchdog peripheral to use a low precision clock source,
35+
* e.g. the LSI RC acts as a clock source for the IWDG on ST targets.
36+
* According to the ST spec, the 37 kHz LSI is guaranteed to have a frequency
37+
* around 37-38 kHz, but the actual frequency range guaranteed by the production
38+
* tests is 26 kHz up to 56 kHz.
39+
* Bearing that in mind, a 100 ms timeout value may actually last as long as 142 ms
40+
* and as short as 66 ms.
41+
* The value of 35 ms is used to cover the worst case scenario (66 ms).
42+
*/
43+
#define KICK_ADVANCE_MS 35UL
3044

3145
#define MSG_VALUE_DUMMY "0"
3246
#define CASE_DATA_INVALID 0xffffffffUL

TESTS/mbed_hal/watchdog_reset/main.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,21 @@
2626
#include "mbed.h"
2727

2828
#define TIMEOUT_MS 100UL
29-
#define KICK_ADVANCE_MS 10UL
29+
30+
/* This value is used to calculate the time to kick the watchdog.
31+
* Given the watchdog timeout is set to TIMEOUT_MS, the kick will be performed
32+
* with a delay of (TIMEOUT_MS - KICK_ADVANCE_MS), after the init.
33+
*
34+
* It is common for the watchdog peripheral to use a low precision clock source,
35+
* e.g. the LSI RC acts as a clock source for the IWDG on ST targets.
36+
* According to the ST spec, the 37 kHz LSI is guaranteed to have a frequency
37+
* around 37-38 kHz, but the actual frequency range guaranteed by the production
38+
* tests is 26 kHz up to 56 kHz.
39+
* Bearing that in mind, a 100 ms timeout value may actually last as long as 142 ms
40+
* and as short as 66 ms.
41+
* The value of 35 ms is used to cover the worst case scenario (66 ms).
42+
*/
43+
#define KICK_ADVANCE_MS 35UL
3044

3145
#define MSG_VALUE_DUMMY "0"
3246
#define CASE_DATA_INVALID 0xffffffffUL

0 commit comments

Comments
 (0)