Hello!
Reaching out in parallel to David Barlia who I’m working with on this project.
He sent an email requesting feedback on the same subject, but I’m also going to post here with additional context to his questions in effort to troubleshoot our issue.
Our device/application is meant to travel to various locations and thus likely through diverse cellular conditions and so needs to be able to regain LTE connection after it’s lost so we can send messages to nrfcloud.com
Our application is partially based upon the cloud-client sample, so has the following prj.conf option:
CONFIG_NRF_CLOUD_CONNECTION_POLL_THREAD=y
which seems to prompt the code to poll for nrfcloud.com every 30 seconds whenever a connection is lost, but it doesn’t seem to attempt to regain LTE connection after it’s lost in this initial sample. We’re simulating the LTE disconnect/reconnection event by pausing and then resuming our Sim in hologram.io which appears to be a valid method for testing this issue.
Pressing RST to reboot the device works to trigger the reconnection to LTE/nrfcloud.com but this will not be possible when the device is deployed.
So I’ve tried a few different approaches to manually request the LTE connection to reconnect:
In the nrfcloud polling function
static void connect_work_fn(struct k_work *work)
I tried manually rebooting the modem with the following:
`lte_error = lte_lc_deinit();
if ( lte_error ) {
LOG_INF("Failed to power down modem.");
} else {
LOG_INF("Modem powered off.");
}
LOG_INF("Attempting to Reconnect LTE.");
lte_error = lte_lc_init_and_connect(); //`
This appears to work when the length of time of the disconnect is less than the length of the timeout, but when the disconnect is longer than that it appears the nrfcloud.com polling stops and so it seems unable to reconnect thereafter.
I tried using the non-blocking alternative to the reinitialization:
lte_lc_init_and_connect_async(lte_handler)
Which doesn’t stop the nrfcloud polling, but this approach doesn’t seem to ever regain the LTE connection.
We’re working with the 1.4.1 version of the toolkit as suggested by you and the thing-plus documentation, though we’ve noticed that there’s a flag in the prj.conf for 1.9.1 toolkit which allows you to set the LTE reconnection delay in seconds. This doesn’t appear to be an option in the 1.4.1 toolkit however.
I’ve found sparse information about the reconnection process in this forum, though there are a few hints in the Nordic Semiconductor forum that suggests the preferred method for reconnecting LTE is to poll the LTE state in the main thread with:
lte_lc_nw_reg_status_get()
then reboot the modem similar to how I have been. These posts are quite old, however and experiments I’ve done with this function so far have been unsuccessful so I prefer to rely on the status responses from the lte_handler.
I’m curious if you can offer any feedback about how we might resolve our LTE reconnection issue.
Should we try to upgrade to a newer version of the toolkit? Is there a different method of power cycling the modem that we should be using? Is there a function that we can call to just retrigger the device to reboot completely from software to simulate the RST button to regain connection?
Thanks again for your help and feedback.