<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70667/nrf9160-modem-could-not-get-response-prefix-error--22</link><description>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: 
 
 
 
 eventually lte_lc_connect(); returns the errors below. 
 Could not get response prefix</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 11 Jun 2021 14:55:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70667/nrf9160-modem-could-not-get-response-prefix-error--22" /><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/314956?ContentTypeID=1</link><pubDate>Fri, 11 Jun 2021 14:55:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caf992b6-6807-4678-ae2d-893c0786bca3</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/311261?ContentTypeID=1</link><pubDate>Mon, 24 May 2021 16:27:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:576bbdd6-836e-4343-8278-65cff324a8d6</guid><dc:creator>Varouzan</dc:creator><description>&lt;p&gt;Hello Hakon,&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t seen any difference in behavior after adding that&amp;nbsp; function call.&lt;br /&gt;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?&lt;br /&gt;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.&lt;/p&gt;
&lt;p&gt;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 &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/52819/nrf9160-modem-not-responding-after-switching-to-offline-mode"&gt;this &lt;/a&gt;thread, &amp;quot;I count 9 sockets being used in that code before the modem stops responding&amp;quot; is mentioned.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/298481?ContentTypeID=1</link><pubDate>Mon, 08 Mar 2021 16:41:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31be5f11-6610-4b52-bd25-93d7e6987ed2</guid><dc:creator>Hakon</dc:creator><description>[quote user="Varouzan"]Is it not needed following the lte_lc_offline();? granted lte_lc_init();&amp;nbsp; is called at least once at startup.[/quote]
&lt;p&gt;&amp;nbsp;The documentation says &amp;quot;prior to calling this function a call to &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/include/modem/lte_lc.html?highlight=lte_lc_offline#group__lte__lc_1ga4fc0107680cd13002f78b37a95bf7e78"&gt;&lt;span&gt;lte_lc_init&lt;/span&gt;&lt;/a&gt; must be made, otherwise -EPERM is returned.&amp;quot;. It doesn&amp;#39;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().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/297881?ContentTypeID=1</link><pubDate>Thu, 04 Mar 2021 16:30:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61d5a079-a022-45d8-b1e0-32b1087f9d22</guid><dc:creator>Varouzan</dc:creator><description>&lt;p&gt;Yes, using NCS 1.2.0.&lt;/p&gt;
&lt;p&gt;I am runninhg lte_lc_init(); as part of reconnecting sequence. Is it not needed following the lte_lc_offline();? granted lte_lc_init();&amp;nbsp; is called at least once at startup.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/297834?ContentTypeID=1</link><pubDate>Thu, 04 Mar 2021 13:53:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69aa4ed1-1e00-428f-81b1-ab0bb5c1bf9c</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Also, just to confirm, is it NCS 1.2.0 you are using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/296803?ContentTypeID=1</link><pubDate>Mon, 01 Mar 2021 10:39:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a161ac5-b97e-4853-8e03-ad72fd2302dd</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Thank you. By the way, is there any reason you want run lte_lc_init() multiple times in rapid succession? Is this something that can be avoided?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/296389?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 20:53:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d75ca5c-3cec-4e85-8d1d-db9eb4667dd2</guid><dc:creator>Varouzan</dc:creator><description>&lt;p&gt;1.2.0&lt;/p&gt;
&lt;p&gt;In case this helps, found a similar error reported.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/71162/nrf9160-at_write-failed-to-send-at-command-err-22"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/71162/nrf9160-at_write-failed-to-send-at-command-err-22&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/295992?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 11:05:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8f7f937-e4a3-46a6-ad27-c3dda9b03102</guid><dc:creator>Hakon</dc:creator><description>[quote user=""]Developing on Zephyr 1.2 and modem fw 1.2.[/quote]
&lt;p&gt;&amp;nbsp;What is the exact modem firmware version? 1.2.0?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/295786?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 10:21:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e60de7fa-bfbe-4d1c-969d-53f5399f3f9c</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Thank you, I will submit the trace for analysis.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/295231?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 21:54:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ddaffae-7366-4745-93b0-35515355d378</guid><dc:creator>Varouzan</dc:creator><description>&lt;p&gt;So I ported part of my project to run on the nordic dev kit since I was using a custom PCB and I captured the modem trace. You can get the file from the link below.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/varouzan/nordic_debug_trace_files/blob/main/trace-2021-02-18T21-09-29.452Z.bin"&gt;https://github.com/varouzan/nordic_debug_trace_files/blob/main/trace-2021-02-18T21-09-29.452Z.bin&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Running the code on the dev kit I was not able to see the &amp;quot;Could not get response prefix, error: -22&amp;quot; error message, however the modem eventually stops connecting to the LTE network. This happened after around 15 minutes of connecting to LTE, creating a socket, and disconnecting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/293971?ContentTypeID=1</link><pubDate>Thu, 11 Feb 2021 12:08:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:453a9b39-1c76-4f91-a98b-d1cdeeed437a</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;I tested it and creating a socket doesn&amp;#39;t seem to make a difference. Can you try creating a modem trace of the issue by following &lt;a href="https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/getting-started-cellular/posts/how-to-get-modem-trace-using-trace-collector-in-nrf-connect"&gt;these instructions&lt;/a&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/293918?ContentTypeID=1</link><pubDate>Thu, 11 Feb 2021 09:45:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0a77538-8ef9-47f7-b4dd-924cea3233ad</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Ok, I will try to reproduce this as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/293181?ContentTypeID=1</link><pubDate>Fri, 05 Feb 2021 20:49:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d428e51b-288f-4615-9b98-67aa69d4e30a</guid><dc:creator>Varouzan</dc:creator><description>&lt;p&gt;Hello Hakon,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. That would be hard for me to do.&lt;/p&gt;
&lt;p&gt;However I was able to reproduce the bug pretty consistently by doing the following, so maybe you will be able to do so too.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;lte_lc_init();
lte_lc_connect();

client_fd = socket(AF_INET, SOCK_STREAM, 0);
bind(lte_client_fd, (struct sockaddr *)&amp;amp;local_addr, sizeof(local_addr));
fcntl(lte_client_fd, F_GETFL);
connect(lte_client_fd, (struct sockaddr *)&amp;amp;socket_info,  sizeof(struct sockaddr_in));

lte_lc_offline();&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Doing this on repeat causes the error described on the 8th time.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Connecting and disconnecting without creating a socket does not cause this problem for me, as it probably didn&amp;#39;t for you. It only appears I a socket is created and connect() is called.So assume creating a socket effects this somehow?&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Does this offer any more insight?&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/292215?ContentTypeID=1</link><pubDate>Mon, 01 Feb 2021 12:48:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b918b989-f1a3-4574-9830-de9a7d0a0fc5</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;I ran your code from the system work queue and the modem does not lock. Can you send me your project so I can test it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/291279?ContentTypeID=1</link><pubDate>Tue, 26 Jan 2021 13:28:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba9182e4-d590-44ac-9613-08dca5e16328</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;I will need to reproduce this. This is most likely a bug and not intended behavior.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/291075?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 14:43:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40474d84-67fd-49a7-a20e-c3e2272ba94d</guid><dc:creator>Varouzan</dc:creator><description>&lt;p&gt;We have an lte client thread that wakes up based on a timer interrupt. The thread is suspended when not active.&lt;/p&gt;
&lt;p&gt;Our system also has a separate thread fro GPS.&lt;/p&gt;
&lt;p&gt;Is there a &amp;quot;better&amp;quot; way to reconnect to the network? That doesn&amp;#39;t cause this problem?&lt;/p&gt;
&lt;p&gt;Or a way to unlock the modem?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/291008?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 11:35:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:043a7905-624e-4c36-a56a-fe99c37a33bd</guid><dc:creator>Hakon</dc:creator><description>[quote user=""]If I run the below sequence of commands periodically every 2 min[/quote]
&lt;p&gt;What do you do in between the intervals? Do you sleep or busy wait, or do you use timer interrupts?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/290563?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 14:25:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95fdfc8a-4cf0-4a1c-993a-df4e83a538d2</guid><dc:creator>Varouzan</dc:creator><description>&lt;p&gt;Around 5 times.&lt;/p&gt;
&lt;p&gt;Is there a way to unlock it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 modem : Could not get response prefix, error: -22</title><link>https://devzone.nordicsemi.com/thread/290455?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 10:42:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edcbe173-c013-44f5-b09f-5d580541398b</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""] If I run the below sequence of commands periodically every 2 min:[/quote]
&lt;p&gt;&amp;nbsp;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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>