<?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 reboots sporadically after some time.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/97915/nrf9160-reboots-sporadically-after-some-time</link><description>Hi, 
 
 I searched the forum and could not find a solution to my problem. So I decided to ask it here. 
 I am developing an application that sends some data to the cloud via MQTT. I receive the data and it works fine. However, after some time, the application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 Apr 2023 07:33:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/97915/nrf9160-reboots-sporadically-after-some-time" /><item><title>RE: nrf9160 reboots sporadically after some time.</title><link>https://devzone.nordicsemi.com/thread/418758?ContentTypeID=1</link><pubDate>Mon, 03 Apr 2023 07:33:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17a9eb42-dea9-4847-95b7-0834a2c39b3d</guid><dc:creator>J0sh1101</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;after careful debugging and going through the code, I found that I had memory leak with the cJson library. I did not free all the memory. I freed the the cJson object but not the&amp;nbsp;char* memory buffer.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/didrik-rokhaug"&gt;Didrik Rokhaug&lt;/a&gt;&amp;nbsp; Thanks for the help&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is how it should look when you send an mqtt message using the cJson library:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1680507141268v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 reboots sporadically after some time.</title><link>https://devzone.nordicsemi.com/thread/417483?ContentTypeID=1</link><pubDate>Fri, 24 Mar 2023 15:26:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:147abc98-4eff-43d9-83de-65e4809b9a47</guid><dc:creator>Didrik Rokhaug</dc:creator><description>[quote user="J0sh1101"]Should I add the CONFIG_TFM_SECURE_UART=y?[/quote]
&lt;p&gt;Yes.&lt;/p&gt;
[quote user="J0sh1101"]I noticed that the error occurs whenever there is a context switch in the arch_swap function. [/quote]
&lt;p&gt;Do you have a stack trace before it enters arch_swap?&lt;/p&gt;
[quote user="J0sh1101"]hen I try to remove them, I get an error message. (I have used the AWS IOT example&amp;nbsp; as a base).[/quote]
&lt;p&gt;What error message do you get?&lt;/p&gt;
&lt;p&gt;The options shouldn&amp;#39;t cause the crash you are seeing, but I also cannot see why they cause an error when you remove them.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 reboots sporadically after some time.</title><link>https://devzone.nordicsemi.com/thread/417234?ContentTypeID=1</link><pubDate>Thu, 23 Mar 2023 20:33:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ae01f57-3d1b-44d9-b6a8-48025735afd0</guid><dc:creator>J0sh1101</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have cleaned up my code and updated prj.conf, but I still end up in the Secure Hard Fault Handler. Now, every time I try to connect to the cloud, using the mqtt_conect(), I am landing in the secure hard fault handler. I tried increasing the mqtt buffers, and also increased the heap and stack to 4 kB, but it didn&amp;#39;t change anything. It&amp;#39;s a bit annoying that I can&amp;#39;t look back in the stack frame to see where the error is occurring.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I noticed that the error occurs whenever there is a context switch in the arch_swap function. There is probably a backend in Zephyr that does all the work with sockets and that is where the exception is thrown.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Are there any other options in zephyr or nordic where I can change something in the pry.conf file to get more logs or information? Or call a function to give me more info?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your time and help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 reboots sporadically after some time.</title><link>https://devzone.nordicsemi.com/thread/417001?ContentTypeID=1</link><pubDate>Thu, 23 Mar 2023 09:40:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e158f4d6-eb80-41ab-b8fb-285dc7a623f2</guid><dc:creator>J0sh1101</dc:creator><description>&lt;p&gt;I added CONFIG_TFM_SECURE_UART_SHARE_INSTANCE to prj.conf, but I did not notice any difference. After hovering over the &lt;span&gt;CONFIG_TFM_SECURE_UART_SHARE_INSTANCE&amp;nbsp;, I got this text:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;CONFIG_TFM_SECURE_UART_SHARE_INSTANCE was assigned the value y, but got the value n. Missing dependencies:&lt;br /&gt;TFM_SECURE_UART&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Should I add the CONFIG_TFM_SECURE_UART=y?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In proj.conf I have the AWS_IOT flags in there, even though I don&amp;#39;t use the aws_iot library. Is this ok? Could this produce the problem. When I try to remove them, I get an error message. (I have used the AWS IOT example&amp;nbsp; as a base).&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have this flags:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_AWS_IOT&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_AWS_IOT_CLIENT_ID_STATIC&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;quot;aero_sens&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_AWS_IOT_BROKER_HOST_NAME&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;quot;example.endpoint.com&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_AWS_IOT_SEC_TAG&lt;/span&gt;&lt;span&gt;=201&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_AWS_IOT_APP_SUBSCRIPTION_LIST_COUNT&lt;/span&gt;&lt;span&gt;=2&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_AWS_IOT_LAST_WILL&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_AWS_IOT_TOPIC_GET_ACCEPTED_SUBSCRIBE&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 reboots sporadically after some time.</title><link>https://devzone.nordicsemi.com/thread/416836?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2023 13:55:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e056bedd-81eb-4fc4-9025-c574603b38dc</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Could you add CONFIG_TFM_SECURE_UART_SHARE_INSTANCE=y to your prj.conf as well?&lt;/p&gt;
&lt;p&gt;That should let the secure fault handler output some information about the crash.&lt;/p&gt;
[quote user="J0sh1101"]What could be the reason to execute the secure fault handler?[/quote]
&lt;p&gt;The application trying to access something in secure memory is the most likely cause. The reason for this might be a stack or buffer overflow, or another form of pointer error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 reboots sporadically after some time.</title><link>https://devzone.nordicsemi.com/thread/416632?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2023 16:32:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3099346-85e0-4be3-ab58-56d07527bfea</guid><dc:creator>J0sh1101</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I added the flags to prj.conf and added a new LTE link monitor result in the first post. Basically, there is now the prj.conf file and the lte link monitor 2 file. From the logs, it appears that the application just stops and waits after it sends the second time. After debugging the application, I found that it was stuck in a secure error handler. I tried tracing the call stack to see what the error could be, but I couldn&amp;#39;t dig deeper because the &amp;quot;source is unknown&amp;quot;. Below is a snippet of my ide and the call stack.&lt;/p&gt;
&lt;p&gt;snipped of the IDE:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1679417718442v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;What could be the reason to execute the secure fault handler?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 reboots sporadically after some time.</title><link>https://devzone.nordicsemi.com/thread/416535?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2023 12:41:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f1488cf-3471-41f9-a4f8-376273146cdf</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The reboot is probably because the application crashes.&lt;/p&gt;
&lt;p&gt;Could you add CONFIG_RESET_ON_FATAL_ERROR=n and CONFIG_THREAD_NAME=y to your prj.conf?&lt;/p&gt;
&lt;p&gt;That should give us more information about why the application crashes.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>