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
  • Hello Hakon,

    Sorry for the late reply. That would be hard for me to do.

    However I was able to reproduce the bug pretty consistently by doing the following, so maybe you will be able to do so too.

    lte_lc_init();
    lte_lc_connect();
    
    client_fd = socket(AF_INET, SOCK_STREAM, 0);
    bind(lte_client_fd, (struct sockaddr *)&local_addr, sizeof(local_addr));
    fcntl(lte_client_fd, F_GETFL);
    connect(lte_client_fd, (struct sockaddr *)&socket_info,  sizeof(struct sockaddr_in));
    
    lte_lc_offline();

    Doing this on repeat causes the error described on the 8th time.

    Connecting and disconnecting without creating a socket does not cause this problem for me, as it probably didn't for you. It only appears I a socket is created and connect() is called.So assume creating a socket effects this somehow?

    A have also tried closing the socket, both before and after going into offline mode, but the end result was the same and the error remained.

    Does this offer any more insight?

    Thank you.

Children
Related