<?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>ASSERTION FAIL [err == 0] and Error writing variable 1 (err: -116)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112061/assertion-fail-err-0-and-error-writing-variable-1-err--116</link><description>Now I am using the https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/direction_finding_central/README.html and https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/direction_finding_peripheral</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Jun 2024 02:56:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112061/assertion-fail-err-0-and-error-writing-variable-1-err--116" /><item><title>RE: ASSERTION FAIL [err == 0] and Error writing variable 1 (err: -116)</title><link>https://devzone.nordicsemi.com/thread/489171?ContentTypeID=1</link><pubDate>Tue, 18 Jun 2024 02:56:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0f9931b-b4a6-4103-a7d1-1ebd1d8e5f81</guid><dc:creator>Zihao</dc:creator><description>&lt;p&gt;Sure, thank you. That&amp;#39;s probably because interrupt operations are not recommended to occur simultaneously with NVS write operations. I think there might be a proper solution that allows NCS to handle this time-sensitive procedure well. After directly removing the assert statement, my program seems to be running normally.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [err == 0] and Error writing variable 1 (err: -116)</title><link>https://devzone.nordicsemi.com/thread/489130?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2024 13:50:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf9697e4-21d6-4cfa-9774-8b5ce615d1e8</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;[quote user=""]I understand that error -116 indicates a certificate/key issue through &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/100211/asset-tracker-mqtt-error--116?ReplyFilter=Answers&amp;amp;ReplySortBy=Answers&amp;amp;ReplySortOrder=Descending"&gt;this issue&lt;/a&gt;. However, I have not configured any certificates or keys. Therefore, I suspect this issue might be related to the scanning process. The &lt;code&gt;scan_timeout&lt;/code&gt; callback function is triggered while the central device is still scanning. Interestingly, I can successfully write the variable when the central device is connected.[/quote]&lt;/div&gt;
&lt;div&gt;&lt;span&gt;You can find what all of these error codes mean in errno.h. &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/lib/libc/minimal/include/errno.h"&gt;For instance here&lt;/a&gt;. -116 allways means means &amp;quot;Connection timed out&amp;quot;. In the context of the issue you linked to, that typically stems from certificate&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;or key issues, though I do not think that is the issue here.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;My immediate idea on this issue is that it is related to the time-sensitive nature of this procedure. You should make sure that you do other things (ie. write to NVS) in a workqueue so that it won&amp;#39;t hinder the connection.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Elfving&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [err == 0] and Error writing variable 1 (err: -116)</title><link>https://devzone.nordicsemi.com/thread/488637?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 10:18:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c6f18d0-eeca-43ae-8a39-453ac473029a</guid><dc:creator>Zihao</dc:creator><description>&lt;p&gt;OK, I tried to delete the ASSERTION in &lt;code&gt;WEST_TOPDIR/zephyr/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c:476&lt;/code&gt;. After that, my project worked fine.&lt;/p&gt;
&lt;p&gt;The ASSERTION is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	if (diff &amp;gt; HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US)) {
		/* TODO: for Low Latency Feature with Advanced XTAL feature.
		 * 1. Release retained HF clock.
		 * 2. Advance the radio event to accommodate normal prepare
		 *    duration.
		 * 3. Increase the preempt to start ticks for future events.
		 */
		
		/*
		LL_ASSERT_MSG(false, &amp;quot;%s: Actual EVENT_OVERHEAD_START_US = %u&amp;quot;,
			      __func__, HAL_TICKER_TICKS_TO_US(diff));
		*/
		
		return 1U;
	}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;However, I&amp;#39;m not sure if this operation has any additional drawbacks. In my development experience, assertions are sometimes left in release versions, and if such assertions are not satisfied, the consequences can be fatal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [err == 0] and Error writing variable 1 (err: -116)</title><link>https://devzone.nordicsemi.com/thread/488604?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 07:46:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:451e0265-b234-4c26-9e29-d3fa762aa24a</guid><dc:creator>Zihao</dc:creator><description>&lt;p&gt;More precise. my issue is&lt;strong&gt;&amp;nbsp;why can&amp;#39;t I update a variable in NVS when the k_timer is triggered？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I know it&amp;#39;s not recommended to call a Read/Write function in a k_timer event call back function. So I defined a variable TIMEOUT_FLAG = false.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;When the k_timer event occur, the TIMEOUT_FLAG well be set to true.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And in my main function:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;while(1){&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; if(TIMEOUT_FLAG){&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Write_to_NVS();&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; k_sleep(K_MSEC(500));&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sys_reboot(0);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; k_sleep(K_MSEC(500));&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But the Errors still exist.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;Scan timeout, no connection established. TIMEOUT...
ASSERTION FAIL [0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c:476
	lll_preempt_calc: Actual EVENT_OVERHEAD_START_US = 2990
[00:00:15.302,795] &#x1B;[1;31m&amp;lt;err&amp;gt; os: esf_dump: r0/a1:  0x00000003  r1/a2:  0x00000000  r2/a3:  0x00000001&#x1B;[0m
[00:00:15.302,825] &#x1B;[1;31m&amp;lt;err&amp;gt; os: esf_dump: r3/a4:  0x00020c29 r12/ip:  0x00000000 r14/lr:  0x00001f7b&#x1B;[0m
[00:00:15.302,825] &#x1B;[1;31m&amp;lt;err&amp;gt; os: esf_dump:  xpsr:  0x41000028&#x1B;[0m
[00:00:15.302,856] &#x1B;[1;31m&amp;lt;err&amp;gt; os: esf_dump: Faulting instruction address (r15/pc): 0x00001f86&#x1B;[0m
[00:00:15.302,886] &#x1B;[1;31m&amp;lt;err&amp;gt; os: z_fatal_error: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0&#x1B;[0m
[00:00:15.302,886] &#x1B;[1;31m&amp;lt;err&amp;gt; os: z_fatal_error: Fault during interrupt handling
&#x1B;[0m
[00:00:15.302,947] &#x1B;[1;31m&amp;lt;err&amp;gt; os: z_fatal_error: Current thread: 0x200016b0 (unknown)&#x1B;[0m
[00:00:15.603,393] &#x1B;[1;31m&amp;lt;err&amp;gt; fatal_error: k_sys_fatal_error_handler: Resetting system&#x1B;[0m
*** Booting Zephyr OS build v3.2.99-ncs1 *** &lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>