Developing on Zephyr 1.2 and modem fw 1.2.
Developing a client LTE application. If I run the below sequence of commands periodically every 2 min:
eventually lte_lc_connect(); returns the errors below.
Could not get response prefix, error: -22 Could not get network registration status
After this the modem seems to be stuck in a bad state , as I can't get it to reconnect to the network running the above sequence.
Is there a good way to recover that modem, and what does that error mean excactly?
If I run the below sequence of commands periodically every 2 min:
How many times do you need to run this before the modem becomes unresponsive? The modem is supposed to lock if you try to reboot it too many times in rapid succession.
Around 5 times.
Is there a way to unlock it?
Also, just to confirm, is it NCS 1.2.0 you are using?
Yes, using NCS 1.2.0.
I am runninhg lte_lc_init(); as part of reconnecting sequence. Is it not needed following the lte_lc_offline();? granted lte_lc_init(); is called at least once at startup.
Varouzan said:Is it not needed following the lte_lc_offline();? granted lte_lc_init(); is called at least once at startup.
The documentation says "prior to calling this function a call to lte_lc_init must be made, otherwise -EPERM is returned.". It doesn't say it needs to be called again if you set the modem to offline. You probably need to set the modem back to normal mode again though, using lte_lc_normal().
I haven't seen any difference in behavior after adding that function call.Is there any recommended action required for sockets in the case the lte connection is lost? Perhaps closing the socket before switching the modem to offline mode?From what I have seen the modem closes the socket when it looses the connection. Or the socket file descriptor becomes invalid. Correct me if I am wrong.
I am bringing up the sockets because this issue described in this thread comes up after the modem disconnects and reconnects to the lte network 8 times, and in this thread, "I count 9 sockets being used in that code before the modem stops responding" is mentioned.
I was not able to reproduce the issue you see, but in general you should not be calling lte_lc_init() multiple times in a row. You can try reproducing this on NCS 1.5, and if you are able to do that, you can upload a sample and I will try it.