LTE connection timeout & retry policy

Hello,

in our application, we use nb-iot and PSM with wake-up period of 60 minutes.

CONFIG_LTE_NETWORK_TIMEOUT is set to default value (600 seconds).

In case bad link quality is present, or no network at all, what behavior should we expect?

Let's say the modem goes to sleep and link quality goes very bad.

Will the modem:

  • wake up
  • try to scan for 10 minutes
  • fail to connect
  • go to sleep
  • wakeup the following hour?

Is that correct? We have to understand what will be our current consumption when link quality is very bad, and how to limit this to a reasonable value.

Thanks

Marco

Parents
  • Hello Marco, 

    Due to Christmas Holidays our team is lower staffed than normal and some delays in our answers must be expected. We apologize for the inconvenience.



    Can you provide some information on what version of the modem FW and nRF Connect SDK you are running? 

    we use nb-iot and PSM with wake-up period of 60 minutes.

    Is this the PSM that the network provides you?

    what behavior should we expect?

    From nrf\lib\lte_link_control\lte_lc.c

    static int connect_lte(bool blocking)
    {
    	int err;
    	int tries = (IS_ENABLED(CONFIG_LTE_NETWORK_USE_FALLBACK) ? 2 : 1);
    	enum lte_lc_func_mode current_func_mode;
    	enum lte_lc_nw_reg_status reg_status;
    	static atomic_t in_progress;
    
    	if (!is_initialized) {
    		LOG_ERR("The LTE link controller is not initialized");
    		return -EPERM;
    	}
    
    	/* Check if a connection attempt is already in progress */
    	if (atomic_set(&in_progress, 1)) {
    		return -EINPROGRESS;
    	}
    
    	err = lte_lc_nw_reg_status_get(&reg_status);
    	if (err) {
    		LOG_ERR("Failed to get current registration status");
    		return -EFAULT;
    	}
    
    	/* Do not attempt to register with an LTE network if the device already is registered.
    	 * This check is needed for blocking _connect() calls to avoid hanging for
    	 * CONFIG_LTE_NETWORK_TIMEOUT seconds waiting for a semaphore that will not be given.
    	 */
    	if ((reg_status == LTE_LC_NW_REG_REGISTERED_HOME) ||
    	    (reg_status == LTE_LC_NW_REG_REGISTERED_ROAMING)) {
    		LOG_DBG("The device is already registered with an LTE network");
    
    		err = 0;
    		goto exit;
    	}
    
    	if (blocking) {
    		k_sem_init(&link, 0, 1);
    	}
    
    	do {
    		tries--;
    
    		err = lte_lc_func_mode_get(&current_func_mode);
    		if (err) {
    			err = -EFAULT;
    			goto exit;
    		}
    
    		/* Change the modem sys-mode only if it's not running or is meant to change */
    		if (!IS_ENABLED(CONFIG_LTE_NETWORK_DEFAULT) &&
    		    ((current_func_mode == LTE_LC_FUNC_MODE_POWER_OFF) ||
    		     (current_func_mode == LTE_LC_FUNC_MODE_OFFLINE))) {
    			err = lte_lc_system_mode_set(sys_mode_target, mode_pref_current);
    			if (err) {
    				err = -EFAULT;
    				goto exit;
    			}
    		}
    
    		err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_NORMAL);
    		if (err || !blocking) {
    			goto exit;
    		}
    
    		err = k_sem_take(&link, K_SECONDS(CONFIG_LTE_NETWORK_TIMEOUT));
    		if (err == -EAGAIN) {
    			LOG_INF("Network connection attempt timed out");
    
    			if (IS_ENABLED(CONFIG_LTE_NETWORK_USE_FALLBACK) &&
    			    (tries > 0)) {
    				if (sys_mode_target == sys_mode_preferred) {
    					sys_mode_target = sys_mode_fallback;
    				} else {
    					sys_mode_target = sys_mode_preferred;
    				}
    
    				err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_OFFLINE);
    				if (err) {
    					err = -EFAULT;
    					goto exit;
    				}
    
    				LOG_INF("Using fallback network mode");
    			} else {
    				err = -ETIMEDOUT;
    			}
    		} else {
    			tries = 0;
    		}
    	} while (tries > 0);
    
    exit:
    	atomic_clear(&in_progress);
    
    	return err;
    }

    Kind regards,
    Øyvind

  • Hello Oyvind,

    our SDK 2.0.2 is and modem FW is 1.3.3.

    60 minutes is the PSM time given by network.

    We don't really understand the behavior. From our application, we call lte_lc_connect_async() and then we listen to events. I see that lte_lc_connect_async() then calls connect_lte().

    • analyzing the connect_lte() function - which is called with blocking = false - it seems that it just exits without blocking and it is not influencing the behaviour of the modem, the CONFIG_LTE_NETWORK_TIMEOUT is not even used with blocking=false. Do I miss something?
    • also, this function does not explain what happens if modem is connected but THEN the network goes out of reach (let's say I put it in a shieldbox AFTER it completed the first connection)

    Thanks in advance!

  • Hi Marco, 

    Yes, you can test this to verify your needs. It seems that you can also combine %XDATAPRFL and %PERIODICSEARCHCONF.. 

    Kind regards,
    Øyvind

  • Thanks!

    Is that function also available via lte link controller library?

    Marco

  • No, does not look like it is, only as an AT command.

    -Øyvind

  • Thanks Oyvind,

    we will try that soon and let you know!

    Marco

  •  

    Though this is now some time ago, what is your experience in the meantime with power saving and the network search, maybe with XDATAPRFL or PERIODICSEARCHCONF?

Reply Children
No Data
Related