<?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>App Crash if modem commands are issues on the main thread</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70133/app-crash-if-modem-commands-are-issues-on-the-main-thread</link><description>I think that the related ticket to the problem that we have observed is: 
 https://devzone.nordicsemi.com/f/nordic-q-a/60850/nrf9160-secure-services-causing-a-crash 
 I have seen some info where this crash is being investigated, but I am not sure if solution</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Jan 2021 07:23:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70133/app-crash-if-modem-commands-are-issues-on-the-main-thread" /><item><title>RE: App Crash if modem commands are issues on the main thread</title><link>https://devzone.nordicsemi.com/thread/287842?ContentTypeID=1</link><pubDate>Thu, 07 Jan 2021 07:23:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09f481e0-13b8-440a-b5e7-aef524e6ca52</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Nik,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Nikola Markkovic"]I&amp;#39;ve seen that thread and as I mentioned earlier, I didn&amp;#39;t understand how spm_config in Kconfig has effect on the project as it is separate from the main application Kconfig, if something had to be programmed separately, so I didn&amp;#39;t pursue that route.[/quote]
&lt;p&gt;MQTT fetches a random number and uses that as a part of the meta-data sent to the broker, in the data_publish() function. This will be a non-secure callable function to the secure region.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user="Nikola Markkovic"]&lt;p&gt;&lt;span&gt;But say, it spm stack size that needed to be adjusted, how come it was enough for the library calls (which in effect do the same thing) rather than&amp;nbsp;direct&amp;nbsp;nrf_socket(AF_LTE) + nrf_send from main thread. The actual string that I Was sending was a const like &amp;quot;AT+CCLK?\r&amp;quot; (just \r, right?) Those calls perhaps did something different&amp;nbsp;that didn&amp;#39;t&amp;nbsp;trigger&amp;nbsp;the crash. I did my due diligence&amp;nbsp;to ensure&amp;nbsp;that I had enough command buffers on my end.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I could never get a stack trace/printout because USB was late in connecting. It would be a hard fault and some registers would point to areas around AT command handler and possibly &amp;quot;spm&amp;quot;. I think it was a &amp;quot;secure&amp;nbsp;hard fault&amp;quot;&amp;nbsp; or something like that. The crash would happen inside https socket send(fd),.or was it recv()... I believe, and it would crash as I would try to step over into the native socket function that I had no source for.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Sorry, this is as much as I have to offer on this issue probably. I&amp;#39;m thinking that the way to reproduce might be to run the https sample in a loop, but add&amp;nbsp;nrf_socket send/receive AT+CCLK into the mix. I may not have the bandwidth to go back and try reproduce this, so feel free to close out this issue if the information is not useful.&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;&amp;nbsp;My apologies, but without debug information, it is very hard to say what went wrong in this scenario.&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><item><title>RE: App Crash if modem commands are issues on the main thread</title><link>https://devzone.nordicsemi.com/thread/287792?ContentTypeID=1</link><pubDate>Wed, 06 Jan 2021 16:44:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fead6e72-bc87-4da6-b1d2-bf5e736e16be</guid><dc:creator>Nikola Markovic</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;ve seen that thread and as I mentioned earlier, I didn&amp;#39;t understand how spm_config in Kconfig has effect on the project as it is separate from the main application Kconfig, if something had to be programmed separately, so I didn&amp;#39;t pursue that route.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But say, it spm stack size that needed to be adjusted, how come it was enough for the library calls (which in effect do the same thing) rather than&amp;nbsp;direct&amp;nbsp;nrf_socket(AF_LTE) + nrf_send from main thread. The actual string that I Was sending was a const like &amp;quot;AT+CCLK?\r&amp;quot; (just \r, right?) Those calls perhaps did something different&amp;nbsp;that didn&amp;#39;t&amp;nbsp;trigger&amp;nbsp;the crash. I did my due diligence&amp;nbsp;to ensure&amp;nbsp;that I had enough command buffers on my end.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I could never get a stack trace/printout because USB was late in connecting. It would be a hard fault and some registers would point to areas around AT command handler and possibly &amp;quot;spm&amp;quot;. I think it was a &amp;quot;secure&amp;nbsp;hard fault&amp;quot;&amp;nbsp; or something like that. The crash would happen inside https socket send(fd),.or was it recv()... I believe, and it would crash as I would try to step over into the native socket function that I had no source for.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Sorry, this is as much as I have to offer on this issue probably. I&amp;#39;m thinking that the way to reproduce might be to run the https sample in a loop, but add&amp;nbsp;nrf_socket send/receive AT+CCLK into the mix. I may not have the bandwidth to go back and try reproduce this, so feel free to close out this issue if the information is not useful.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Nik&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: App Crash if modem commands are issues on the main thread</title><link>https://devzone.nordicsemi.com/thread/287687?ContentTypeID=1</link><pubDate>Wed, 06 Jan 2021 11:04:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06bc8d4f-62db-4b35-950b-5a4ae2585878</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;
[quote user=""]&lt;p&gt;&lt;span&gt;The problem is that on a third cycle or so, the application would crash typically on HTTP requests or rarely during MQTT startup.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The application has a generous stack and heap allocation of 8K each. We have also tried&amp;nbsp;tweaking various stack sizes and Kconfig settings per some posts that we have seen on the forums, but none of those seemed to help. The same behavior existed in SDK 1.3.0, 1.3.1 and 1.4.0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;We have since modified our code to make use of&amp;nbsp;date_time and modem_info libraries provided by Nordic and the problem completely disappeared and the application is stable now.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have posted this ticket in hopes that it would help reproduce and resolve this issue and in hopes that someone can review and determine whether this is the same problem and whether the same workaround&amp;nbsp;applies.&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;&amp;nbsp;It could be that the issue is related to the SPM stack size. Please see this thread on how to adjust that higher:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/68395/nrf9160-sdk-1-4-crash-in-random-number-generation"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/68395/nrf9160-sdk-1-4-crash-in-random-number-generation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you have any details on what the fault previously were? Like a printout or stack trace?&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></channel></rss>