This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf9160 modem : Could not get response prefix, error: -22

Hello,

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:

lte_lc_offline();
lte_lc_init();
lte_lc_connect();

 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?

Thank you.

Parents Reply
  • 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().

Children
  • Hello Hakon,

    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.

Related