This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NRF9160's lte_lc_connect() fails when LTE was disabled through AT+CFUN=20 and LTE Mode is on LTE_NETWORK_MODE_LTE_M_GPS

Hello everyone,

We're developing an application that manages the LTE Link reconnections automatically, without interfering the GPS performance. For such purpose, when there is poor cellular coverage, we are disabling the lte functionality without turning off the modem (sending AT+CFUN=20 -> setting to LTE_LC_FUNC_MODE_DEACTIVATE_LTE).

The issue we're experiencing is that when we attempt to re-connect through lte_lc_connect(), it fails because the modem returns error when trying to set AT%XSYSTEMMODE=1,0,1,0 (even though it was already initialized):

/* Snippet of lte_lc.c on master branch */

static int connect_lte(bool blocking)
{
	int err;
	bool retry;

	if (!is_initialized) {
		LOG_ERR("The LTE link controller is not initialized");
		return -EPERM;
	}

	k_sem_init(&link, 0, 1);

	do {
		retry = false;

		if (!IS_ENABLED(CONFIG_LTE_NETWORK_DEFAULT)) {

/* ============= Here's where it fails ============= */
			err = lte_lc_system_mode_set(sys_mode_target, mode_pref_current);
			if (err) {
				return err;
			}

		}

		err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_NORMAL);
		if (err || !blocking) {
			return err;
		}
/* ... */
	} while (retry);

	return err;
}

We are using MFW v1.3.0 and are on NCS v1.6.0, although the issue is also present on the master branch (as of today 210923).

Is this behavior intended? Should we approach the reconnection scheme differently?

I'd appreciate any pointers/suggestions/feedback on this issue.

Luis.

Parents
  • Hi,

    The %XSYSTEMMODE AT command cannot be used while the modem is running, which is why that call fails.

    The lte_lc_connect() isn't made for this scenario.

    However, you can control the function mode directly with lte_lc_func_mode_set() (at least in the newly released NCS v1.7.0). It will send the corresponding AT+CFUN command.

    Best regards,

    Didrik

  • Hi Didrik, Thanks for your reply.

    I understand the reason why lte_lc_connect() performs the AT%XSYSTEMMODE command is to support the fallback scheme between NB-IoT/LTE-M upon timeout. Nevertheless, when this fallback scheme was introduced, the modem didn't support disabling individually LTE or GPS.

    For now, we will roll our own flavor of lte_lc_connect() API (sending AT+CFUN + Hold a semaphore + Trigger connection attempt timeout).

    A couple questions, though:

    - Would you guys consider making lte_lc_connect() aware of this use-case in the future?
    - If so, would you guys be open to review a PR that works for both your current use-case and this one?

    Best regards,

    Luis.

  • If you want to open a PR for this, that would be great.

    If you post a link to it here, I'll make sure someone follwos up on it.

Reply Children
Related