Background
Our device uses the CONFIG_LTE_NETWORK_TIMEOUT
option from LTE Link Control, which by default is set to 600 seconds (10 minutes). I haven’t found any specific recommendations for this timeout value, and all Nordic samples appear to use the default.
Currently, we use the default 600-second timeout. If the device cannot connect, it retries with an increasing delay: 10 seconds, 60 seconds, 10 minutes, 30 minutes, and so on, up to 24 hours. However, this approach leads to rapid battery drain if the device is out of network coverage.
In the office, devices usually connect within 2–10 seconds, but sometimes it takes up to 30 seconds or more. Field behavior is less predictable.
Request
Do you have any recommendations for an appropriate value for CONFIG_LTE_NETWORK_TIMEOUT
?
The devices will be deployed globally, so using a band lock is not ideal due to varying regional bands.
The nRF Connect SDK v2.6.0 is in use.
Relevant Code Snippet
static uint32_t get_next_reconnect_delay_in_sec(int attempt_number)
{
switch (attempt_number) {
case 0:
case 1:
return RECONNECT_DELAY_10_SEC;
case 2:
return RECONNECT_DELAY_60_SEC;
case 3:
return RECONNECT_DELAY_10_MINS;
case 4:
return RECONNECT_DELAY_30_MINS;
case 5:
return RECONNECT_DELAY_1_HOUR;
case 6:
return RECONNECT_DELAY_2_HOUR;
case 7:
return RECONNECT_DELAY_6_HOURS;
case 8:
return RECONNECT_DELAY_12_HOUR;
case 9:
return RECONNECT_DELAY_24_HOUR;
default:
return RECONNECT_DELAY_24_HOUR;
}
}
static int modem_service_start_modem(void)
{
static int attempt_number;
uint32_t reconnect_delay;
LOG_INF("Connecting to LTE network");
for (;;) {
int err = lte_lc_connect();
if (!err) {
break;
}
if (err == -ETIMEDOUT) {
// Timeout error: Modem could not connect within CONFIG_LTE_NETWORK_TIMEOUT
// (default is 600 seconds)
// TODO: Consider reducing CONFIG_LTE_NETWORK_TIMEOUT to save power
LOG_WRN("LTE connection attempt number %d failed!", attempt_number);
attempt_number++;
reconnect_delay = get_next_reconnect_delay_in_sec(attempt_number);
LOG_DBG("Next connection attempt in %u seconds", reconnect_delay);
k_sleep(K_SECONDS(reconnect_delay));
LOG_DBG("Reattempting LTE connection ...");
continue;
}
LOG_ERR("LTE connection attempt failed: %d", err);
return err;
}
LOG_INF("LTE connection established");
attempt_number = 0; // Reset attempt counter after success
...
}
Regards,
Tareq