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.