Skip to content

Commit 8f8ace8

Browse files
committed
Fix timeout limits
1 parent 5777992 commit 8f8ace8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/watchdog_api.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ watchdog_status_t hal_watchdog_init(const watchdog_config_t *config)
2727
{
2828
nrfx_err_t err_code;
2929

30-
// nRF would allow a 4294967295 ms refresh value but
31-
// Mbed OS allows max UINT32_MAX ms rehfreses.
32-
if ( config->timeout_ms < 15U && config->timeout_ms > 65535U ) {
30+
// The nRF watchdogs accept a range from 0xF to maximum 0xFFFF_FFFF
31+
// 32768 Hz ticks. (Plase, see
32+
// https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.3.0%2Fstructnrfx__wdt__config__t.html)
33+
// Min timeout values in ms range from 0x1 to (0xFFFFFFFF / 0x8000) * 1000
34+
if ( config->timeout_ms < 0x1 && config->timeout_ms > 0x07CFFFFF ) {
3335
return WATCHDOG_STATUS_INVALID_ARGUMENT;
3436
}
3537

@@ -72,7 +74,8 @@ uint32_t hal_watchdog_get_reload_value(void)
7274
watchdog_features_t hal_watchdog_get_platform_features(void)
7375
{
7476
watchdog_features_t features;
75-
features.max_timeout = 0xFFFF;
77+
78+
features.max_timeout = 0x07CFFFFF;
7679
features.update_config = false;
7780
features.disable_watchdog = false;
7881
return features;

0 commit comments

Comments
 (0)