<?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 error: 0x4, PC: 0x7ef22</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94358/nrf9160-modem-error-0x4-pc-0x7ef22</link><description>Hi Nordic Team, long story short: I get a [10:04:59.928,985] &amp;lt;err&amp;gt; nrf_modem: Modem error: 0x4, PC: 0x7ef22 and after that the modem does not allow me to open a socket anymore. ncs v2.1.2 modem fw: nrf9160_1.3.3 (on SICA B1) Any ideas of how to prevent</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 09 Feb 2023 22:31:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94358/nrf9160-modem-error-0x4-pc-0x7ef22" /><item><title>RE: nrf9160: Modem error: 0x4, PC: 0x7ef22</title><link>https://devzone.nordicsemi.com/thread/409245?ContentTypeID=1</link><pubDate>Thu, 09 Feb 2023 22:31:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7c1eae1-3ceb-4f0c-8482-c77b67072a56</guid><dc:creator>ClemensG</dc:creator><description>&lt;p&gt;No worries. It was a bit of a ride but finally works.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for the support!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Modem error: 0x4, PC: 0x7ef22</title><link>https://devzone.nordicsemi.com/thread/409228?ContentTypeID=1</link><pubDate>Thu, 09 Feb 2023 18:45:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92b12ee6-8ed2-4e59-a847-ce947dc62a7f</guid><dc:creator>Michal</dc:creator><description>&lt;p&gt;Thank you for the feedback.&lt;/p&gt;
&lt;p&gt;I am sorry to hear that. I understand your frustrations, but unfortunately, modern embedded devices with complex communication protocols are also causing a big increase in software complexity and the choice was made to use Zephyr as the base of our SDK.&lt;/p&gt;
&lt;p&gt;If you feel satisfied with your workaround then I think we can close this ticket, otherwise the lack of modem trace is unfortunately blocking possible deeper debugging.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Michal&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Modem error: 0x4, PC: 0x7ef22</title><link>https://devzone.nordicsemi.com/thread/409123?ContentTypeID=1</link><pubDate>Thu, 09 Feb 2023 11:18:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de9d96ff-3b66-4267-a712-bfc851bc26d2</guid><dc:creator>ClemensG</dc:creator><description>&lt;p&gt;Hi Michal,&lt;/p&gt;
&lt;p&gt;unfortunately I do not have a trace. It happened in a long run experiment after one week where I just logged my debug output. I then used a custom modem error handler that just resets the system. I have 24 units running for a few weeks now (somewhere out in the nature running on batteries, so no trace collector attached) and I have seen three resets due to modem errors but do not know the error code or PC for them.&lt;/p&gt;
&lt;p&gt;I know it does not help you but may help others: For me adding resets (watchdog triggering when not receiving anything for time x, reset on modem error) finally made the thing &amp;quot;reliable&amp;quot;. It is ugly but during development I came across so many (undocumented or documented at places you don&amp;#39;t look at while dealing with the Zephyr API) reasons things could go wrong that I decided to go this way. Not the best for battery life, absolutely not my favorite style of programming but works.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; I came from a FreeRTOS world, where I tried to cleanly deal with errors that could happen in the system while trying to avoid complex scenarios (like dynamic memory allocation) and get things as error free as possible. Just alone that Zephyr adds so much complexity makes this approach impossible. My personal opinion on that: For these small, low power devices, with this small processor (with limited peripherals), Zephyr and all these layers are a complete overkill and unmanageable in a clean way. Especially for the intended applications: small low power devices (with low complexity in their task) that may run for years.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Clemens&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Modem error: 0x4, PC: 0x7ef22</title><link>https://devzone.nordicsemi.com/thread/408776?ContentTypeID=1</link><pubDate>Wed, 08 Feb 2023 09:13:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5a4f386-ef37-43cf-bd30-8c212ad57248</guid><dc:creator>Michal</dc:creator><description>&lt;p&gt;Hello again,&lt;/p&gt;
&lt;p&gt;Would it be possible to get a modem trace anyway?&lt;/p&gt;
&lt;p&gt;It looks like it is a blocking thing in that case.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Michal&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Modem error: 0x4, PC: 0x7ef22</title><link>https://devzone.nordicsemi.com/thread/400044?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2022 03:54:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae450416-f5d0-48cf-b44d-6c66b52c9c63</guid><dc:creator>Michal</dc:creator><description>&lt;p&gt;Hello Clemens,&lt;/p&gt;
&lt;p&gt;Sorry for the delay, I will look more into it.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Michal&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Modem error: 0x4, PC: 0x7ef22</title><link>https://devzone.nordicsemi.com/thread/398886?ContentTypeID=1</link><pubDate>Sun, 04 Dec 2022 20:19:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab5e8ecb-ff9b-445b-8729-ff96dd967186</guid><dc:creator>ClemensG</dc:creator><description>&lt;p&gt;Hmmm.... I am sending one packet (UDP) each minute. I guess adding 200ms delay somewhere might not help. Or is there some kind of a race condition while sending a single packet (haven&amp;#39;t looked at the code where you added the delay)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Modem error: 0x4, PC: 0x7ef22</title><link>https://devzone.nordicsemi.com/thread/398668?ContentTypeID=1</link><pubDate>Fri, 02 Dec 2022 04:39:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8be30f7e-4133-4770-854b-9f26e641ab72</guid><dc:creator>wasan</dc:creator><description>&lt;p&gt;Hi Clemens,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have an issue similar you. Error memory 0x04 appeared in my code. I think there is a problem with the modem&amp;#39;s firmware or library.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m trying to fix this problem by adding a 200mS delay to the function. It can make sending data less likely to go wrong.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;sdk 2.1.2 &amp;gt; nrf &amp;gt; lib &amp;gt; nrf_modem_lib &amp;gt; nrf_modem_os.c&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void *nrf_modem_os_shm_tx_alloc(size_t bytes)
{
    extern uint32_t nrf_modem_lib_shmem_failed_allocs;
    void * const addr = k_heap_alloc(&amp;amp;nrf_modem_lib_shmem_heap, bytes, K_NO_WAIT);

    k_msleep(200);
    if (IS_ENABLED(CONFIG_NRF_MODEM_LIB_MEM_DIAG_ALLOC) &amp;amp;&amp;amp; !addr)
    {
        nrf_modem_lib_shmem_failed_allocs++;
    }

    return addr;
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Note:&lt;/p&gt;
&lt;p&gt;The signal strength in my area is about -70 dBm. If your signal is less than -100. I think you should add more than 200mS to the delay.&lt;/p&gt;
&lt;p&gt;I hope that the Nordic support team will find out what&amp;#39;s going on soon&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Wasan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Modem error: 0x4, PC: 0x7ef22</title><link>https://devzone.nordicsemi.com/thread/398415?ContentTypeID=1</link><pubDate>Wed, 30 Nov 2022 20:41:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7601e27b-efde-4494-91cd-00c2d3096af6</guid><dc:creator>ClemensG</dc:creator><description>&lt;p&gt;Okay, had a bit time to look into this (from user side).&lt;/p&gt;
&lt;p&gt;As outlined &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/modem/nrf_modem_lib.html#modem-fault-handling"&gt;here&lt;/a&gt; i can define my own modem fault handler. Guess saving data and rebooting is the safest option for me.&lt;/p&gt;
&lt;p&gt;Also couldn&amp;#39;t reproduce that error, yet.&lt;/p&gt;
&lt;p&gt;So in case it still is interesting to Nordic to hunt something down I am happy to help, otherwise I can live with it.&lt;/p&gt;
&lt;p&gt;As with most of the stuff I am discovering I mention it here again: I would love to see a general document/manual/best practices writeup of how to get a robust solution. I would not have looked down into the modem_lib documentation as I thought this is &amp;quot;just&amp;quot; a middle layer and I use it through the zephyr interface. Yes, now that I know what to look at I see it&amp;#39;s applied in some samples.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Modem error: 0x4, PC: 0x7ef22</title><link>https://devzone.nordicsemi.com/thread/398070?ContentTypeID=1</link><pubDate>Tue, 29 Nov 2022 11:15:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:056915ce-910e-427b-8334-8bf6d741f36b</guid><dc:creator>ClemensG</dc:creator><description>&lt;p&gt;Ah, forgot to mention:&lt;/p&gt;
&lt;p&gt;the lte_handler() installed is roughly the same as in the udp sample. So every event handled there should be visible in the log but there is nothing.&lt;/p&gt;
&lt;p&gt;Also no special&amp;nbsp; messages from that handler after the last successful tx+rx (besides: &amp;quot;RRC mode: Idle.&amp;quot;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>