<?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>Turning the modem off</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73636/turning-the-modem-off</link><description>I am working on a program that uses both CoAP and GPS in the form of thread. Since both CoAP and GPS uses the modem, I have to turn it off so the other thread can use it. Working on v1.2.0 I can use these functions : 
 
 Which works on v1.2.0. But since</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 07 Apr 2021 12:59:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73636/turning-the-modem-off" /><item><title>RE: Turning the modem off</title><link>https://devzone.nordicsemi.com/thread/303526?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 12:59:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff3bc26c-d55f-4f28-91a9-fe176c606c96</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;120 when using newlib is this errno:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/eblot/newlib/blob/master/newlib/libc/include/sys/errno.h#L151"&gt;https://github.com/eblot/newlib/blob/master/newlib/libc/include/sys/errno.h#L151&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is expected, as you unfortunately cannot de-init the lte_lc library with ncs v1.3.0:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.3.2/lib/lte_link_control/lte_lc.c#L493-L495"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v1.3.2/lib/lte_link_control/lte_lc.c#L493-L495&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can handle this by checking if ret == -EALREADY, and continue with the rest of your setup.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Note: The _deinit function is present in newer versions of ncs again:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.5.0/lib/lte_link_control/lte_lc.c#L795"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v1.5.0/lib/lte_link_control/lte_lc.c#L795&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Turning the modem off</title><link>https://devzone.nordicsemi.com/thread/303371?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 07:48:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c76c24c9-9eca-47de-8d60-4ab5bd8ca2ed</guid><dc:creator>AMG</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/hkn"&gt;Håkon Alseth&lt;/a&gt; The problem lies with lte_lc_init() after the modem is powered off.&amp;nbsp;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;int err = lte_lc_init();
    if (err != 0) {
        printf(&amp;quot;lte_lc_init failed: %d\n&amp;quot;, err);
        return;
    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Which gives :&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span&gt;lte_lc_init failed: -120&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Turning the modem off</title><link>https://devzone.nordicsemi.com/thread/303359?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 07:06:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d24b3cb1-bc8a-49fc-ad87-80b0b6a6f24e</guid><dc:creator>AMG</dc:creator><description>&lt;p&gt;Yes, at_cmd lib is included. The program runs as expected until the modem is being initialized once again for CoAP and then it hang. I&amp;nbsp; am also looking into into the possibility of it being a socket problem as well. Will do a bit more testing and will update after I know some more.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Turning the modem off</title><link>https://devzone.nordicsemi.com/thread/303354?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 06:51:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:946b675b-5aa2-4b31-ad80-b3fa15f02b4c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;What is the error that you observe? Does it return an error code or does it hang?&amp;nbsp;Does the program run as expected until you run into this routine?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;All these calls use the at_cmd library. Is that enabled?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Turning the modem off</title><link>https://devzone.nordicsemi.com/thread/303353?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 06:46:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37c7a548-2227-49cc-9453-1573a871531c</guid><dc:creator>AMG</dc:creator><description>&lt;p&gt;I understand that. My issue is that on v1.3.1 the calls don&amp;#39;t for some reason while they work on v1.2.0. So, currently I am looking for alternatives.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Turning the modem off</title><link>https://devzone.nordicsemi.com/thread/303351?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 06:42:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e90bec62-2961-4453-8196-e2bcb5d6dba1</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Those calls issue AT+CFUN=0, then immediately sets the modem back in AT+CFUN=4 state, and again back to AT+CFUN=0.&lt;/p&gt;
&lt;p&gt;Running only one of these will be sufficient.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>