<?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 fails to connect to NB-IoT</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61822/nrf9160-fails-to-connect-to-nb-iot</link><description>Hello, 
 lately i&amp;#39;ve not been able to connect to NB-IoT network as i did before. 
 Long story short: 
 I&amp;#39;m working with nrf9160 since 3 months and i have been able to connect without any issues to NB-IoT national network. Lately (last month) i had always</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 May 2020 07:36:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61822/nrf9160-fails-to-connect-to-nb-iot" /><item><title>RE: nrf9160 fails to connect to NB-IoT</title><link>https://devzone.nordicsemi.com/thread/252310?ContentTypeID=1</link><pubDate>Fri, 29 May 2020 07:36:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d4bd580-87a7-4f13-8253-a09dd7fc1861</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Fancesco,&lt;br /&gt;I am glad to hear that the solution worked out.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Martin L.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 fails to connect to NB-IoT</title><link>https://devzone.nordicsemi.com/thread/252271?ContentTypeID=1</link><pubDate>Thu, 28 May 2020 17:06:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6e7e845-8d22-4813-a4da-fdd126d6d6e5</guid><dc:creator>frax84</dc:creator><description>&lt;p&gt;Hi Martina,&lt;/p&gt;
&lt;p&gt;everything works like charm now! Wonderful! From 7-8 minutes on having an not stable (or no at all) connection to 6-15 seconds to connect!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I read the tutorial when i started some month ago but was not able to fully grasp how powerful it was. Now that i&amp;#39;m more capable i got how important it is.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Frax&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 fails to connect to NB-IoT</title><link>https://devzone.nordicsemi.com/thread/252164?ContentTypeID=1</link><pubDate>Thu, 28 May 2020 11:59:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:279b3ea5-3844-4163-a800-1f8f4d9ec823</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;Francesco&lt;/span&gt;,&lt;br /&gt;&lt;br /&gt;I am glad to hear that it worked.&lt;/p&gt;
&lt;p&gt;This can easily be done in you application as well when using the &amp;quot;LTE Link Controller&amp;quot; library as you are already using.&lt;/p&gt;
&lt;p&gt;You do not need to do that manual step you included before the &lt;em&gt;lte_lc_connect()&amp;nbsp;&lt;/em&gt;since you can just enable the lte_lc library to take care of it. (so you can remove those lines)&lt;/p&gt;
&lt;p&gt;In the &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/lib/lte_link_control/Kconfig"&gt;Kconfig file to lte_link_control&lt;/a&gt;&amp;nbsp;you can see all the configurations you can set.&lt;br /&gt;So to &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/lib/lte_link_control/Kconfig#L94" rel="noopener noreferrer" target="_blank"&gt;enable legacy PCO&lt;/a&gt;&amp;nbsp;in your application, you can just add the following line in your&amp;nbsp;&lt;em&gt;prj.conf&amp;nbsp;&lt;/em&gt;file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_LTE_LEGACY_PCO_MODE=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And for the preferred LTE technology&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/lib/lte_link_control/Kconfig#L143" rel="noopener noreferrer" target="_blank"&gt; the modem should use&lt;/a&gt; (&lt;em&gt;same as xsystemmode), This is also to be applied in your applications prj.conf file&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_LTE_NETWORK_MODE_NBIOT=y&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then when you &lt;em&gt;lte_lc_init_and_connect()&amp;nbsp;&lt;/em&gt;the library will select and set this settings for you since you have enabled the configurations in &lt;em&gt;prj.conf.&lt;br /&gt;&lt;br /&gt;More about &lt;a href="https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-2-1478313418#h88sjwm54ukvkhdiku1qtdjdb1685yli" rel="noopener noreferrer" target="_blank"&gt;how configurations work is explained in our tutorial.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Martin L.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 fails to connect to NB-IoT</title><link>https://devzone.nordicsemi.com/thread/252150?ContentTypeID=1</link><pubDate>Thu, 28 May 2020 11:30:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87e262db-7fe0-44ed-9f0b-241f052f6de2</guid><dc:creator>frax84</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;thank you for the suggestions. I tried with your first one (AT%XEPCO=0&amp;nbsp; followed by&amp;nbsp;AT%XSYSTEMMODE=0,1,0,0 before AT+CFUN=1) &lt;strong&gt;with &amp;quot;at_client&amp;quot;&lt;/strong&gt; and&lt;strong&gt; it seems to work really well&lt;/strong&gt;. Differently from before, even when my connection worked (2 month ago), the &lt;strong&gt;connection time greatly reduced&lt;/strong&gt; from minutes to seconds.&lt;/p&gt;
&lt;p&gt;Unfortunately i am not able to obtain the same results with my code. Until now i was using the function &lt;strong&gt;lte_lc_init_and_connect()&lt;/strong&gt;, but i&amp;#39;m thinking that this function overwrite my settings (PCO and System Mode). This is what i tried:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//libs include


//routine for modem comunication
int atCmdTxRx(char* command, char* response_buf, int response_buf_len){
    //routine code here - this works, no need to check
}

static void modem_configure(void)
{
  if (IS_ENABLED(CONFIG_LTE_AUTO_INIT_AND_CONNECT)) {
    /* Do nothing, modem is already turned on
    * and connected.
    */
  } else {
    int err;
    char recv_buf[50];
    
    //Modem config as Martin suggested
    err = atCmdTxRx(&amp;quot;AT%XEPCO=0&amp;quot;, recv_buf, sizeof(recv_buf));
    if (err&amp;lt;0)
      printk(&amp;quot;Error %d, PCO not set\n&amp;quot;, err);
    err = atCmdTxRx(&amp;quot;AT%XSYSTEMMODE=0,1,0,0&amp;quot;, recv_buf, sizeof(recv_buf));
    if (err&amp;lt;0)
      printk(&amp;quot;Error %d, NB-IoT mode not set\n&amp;quot;, err);

    //Init network connection
    printk(&amp;quot;LTE Link Connecting ...\n&amp;quot;);
    u32_t lte_init_time= k_uptime_get_32();
    err = lte_lc_init_and_connect();
    //tried even &amp;quot;lte_lc_connect()&amp;quot; with no results as well
    __ASSERT(err == 0, &amp;quot;LTE link could not be established.&amp;quot;);
    printk(&amp;quot;LTE Link Connected!\n&amp;quot;);
    lte_init_time =(k_uptime_get_32()-lte_init_time)/1000;
    printk(&amp;quot;Time to connect: %d seconds\n&amp;quot;, lte_init_time);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As you can see i even tried&amp;nbsp;&lt;strong&gt;lte_lc_connect()&lt;/strong&gt;, skipping the initialization, with no results. I don&amp;#39;t even see CEREG notification (even if i add AT+CEREG=5 command before the function). Is there a procedure to connect with the setup you suggested from code?&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;
&lt;p&gt;Francesco&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 fails to connect to NB-IoT</title><link>https://devzone.nordicsemi.com/thread/251928?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 11:37:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78ffea17-18a8-421d-a9ba-b6716bbaaf57</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Francesco,&lt;br /&gt;Please try sending the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fref_at_commands%2FREF%2Fat_commands%2Fpacket_domain%2Fxepco_set.html&amp;amp;resultof=%22%78%65%70%63%6f%22%20" rel="noopener noreferrer" target="_blank"&gt;following command &lt;/a&gt;(&lt;strong&gt;before&amp;nbsp;&lt;/strong&gt;turning on the modem (AT+CFUN=1)):&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;AT%XEPCO=0

also make sure you select the modem to connect to nb-iot
AT%XSYSTEMMODE=0,1,0,0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fref_at_commands%2FREF%2Fat_commands%2Fmob_termination_ctrl_status%2Fxsystemmode_set.html&amp;amp;resultof=%22%78%73%79%73%74%65%6d%6d%6f%64%65%22%20%22%78%73%79%73%74%65%6d%6d%6f%64%22%20" rel="noopener noreferrer" target="_blank"&gt;Selecting the modem to choose nb-iot&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The first command will tell the modem to use Legacy PCO&amp;nbsp;instead of ePCO.&lt;br /&gt;&lt;br /&gt;2. If your product is going to be used on the Vodafone network you should use the Modem firmware that is certified for that network, as you see&amp;nbsp; mfw: 1.1.0&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So you could try to downgrade to if my first suggestion does not work. (&lt;em&gt;depending on which network you connect to)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;3. &lt;/em&gt;&lt;span&gt;EMM cause #19 &amp;quot;ESM failure&amp;quot; -- &amp;gt;&amp;nbsp;&lt;/span&gt;usually means that the UE (nrf91 in this case&lt;em&gt;) &lt;/em&gt;is rejected from the attach request. There could be several reasons for this, but let&amp;#39;s try the first suggestions and I suspect that at least one of the options will work out.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Br,&lt;br /&gt;martin l.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>