<?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: How to recover when modem call lte_lc_connect() returns -116.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84161/nrf9160-how-to-recover-when-modem-call-lte_lc_connect-returns--116</link><description>I&amp;#39;m using SDK 1.7.0. Here&amp;#39;s how I have the modem code setup. 
 
 Init modem outside of thread loop 
 Set modem at+ comman CFUN=1 (start searching for a tower) 
 Once +CEREG returns data with a 1, I know I have connected to a tower (+CEREG: 5, 1 ,&amp;quot;8404</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Feb 2022 16:21:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84161/nrf9160-how-to-recover-when-modem-call-lte_lc_connect-returns--116" /><item><title>RE: nRF9160: How to recover when modem call lte_lc_connect() returns -116.</title><link>https://devzone.nordicsemi.com/thread/351388?ContentTypeID=1</link><pubDate>Fri, 04 Feb 2022 16:21:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2882be67-512e-4988-86df-8afb770701da</guid><dc:creator>Hakon</dc:creator><description>[quote user="GameCodingNinja"]err = k_sem_take(&amp;amp;link, K_SECONDS(CONFIG_LTE_NETWORK_TIMEOUT));[/quote]
&lt;p&gt;Maybe you can try changing it to k_sem_take(&amp;amp;link, K_FOREVER) to stop it from timing out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160: How to recover when modem call lte_lc_connect() returns -116.</title><link>https://devzone.nordicsemi.com/thread/350495?ContentTypeID=1</link><pubDate>Mon, 31 Jan 2022 15:44:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35ac6ee8-56e2-4965-9012-4db5edcfda07</guid><dc:creator>GameCodingNinja</dc:creator><description>&lt;p&gt;&lt;span&gt;lte_lc_connect_async&lt;/span&gt;&lt;span&gt;() calls the same function&amp;nbsp;connect_lte() but without blocking.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;On line 668 of file lte_lc.c, it times out on the below line.&lt;br /&gt;err = k_sem_take(&amp;amp;link, K_SECONDS(CONFIG_LTE_NETWORK_TIMEOUT));&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is where err = -116 is generated. Not sure why the semaphore is timing out. I even doubled it from 60 seconds to 120.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160: How to recover when modem call lte_lc_connect() returns -116.</title><link>https://devzone.nordicsemi.com/thread/350425?ContentTypeID=1</link><pubDate>Mon, 31 Jan 2022 13:00:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e3a6e2d-3c54-45f5-ba76-51cb197149e9</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]But once&amp;nbsp;lte_lc_connect() returns -116, it will never connect again and I have to reboot the board. Any idea of how I can recover from this?[/quote]
&lt;p&gt;Have you tried just calling &lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;lte_lc_connect_async&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;() after receiving the -116 error? I&amp;#39;m not sure that&amp;#39;s the best way to handle it, but I guess you can try that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>