<?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>NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58481/nrf52840dk-error-caused-in-app_timer2-c-error-code-8</link><description>Hello, 
 In order to try and implement passkeys, I&amp;#39;ve implemented my program inside of the glucose app example. The project compiles + runs and crashes sometimes randomly but usually after connecting and entering the passkey. 
 According to the debugger</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 Mar 2020 18:00:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58481/nrf52840dk-error-caused-in-app_timer2-c-error-code-8" /><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/238611?ContentTypeID=1</link><pubDate>Fri, 06 Mar 2020 18:00:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0e3fe04-79f9-459d-82c0-571f42dac818</guid><dc:creator>Nicholas_Nuti</dc:creator><description>&lt;p&gt;&amp;nbsp;Yeah I do get errors. I guess that comes with rushed development on a mcu I&amp;#39;ve never used before.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; As for the SAADC I have it initialized in the beginning of my program but I can check it. Thank you for the suggestion.&amp;nbsp; I assume the unexpected errors can be overcome with setting custom conditional statements in that ble event handler. I&amp;#39;m going to try it next week.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yes, I based my project on the very most basic ble template. I forget the name currently but I can check next week. Modifications I&amp;#39;ve made: saadc, added a ble service, ble characteristic, modified the basic sleep and wake up, hold bonds on wake up, and added a static passkey. This is a very basic implementation but it&amp;#39;s rushed. I&amp;#39;m at the point of where Im optimizing for battery and I started a private post. I use SDK 16. Thanks for asking.&lt;/p&gt;
&lt;p&gt;Im not used to the... type of documentation and methods of learning how to use this device. Before I was using a scilabs device that had a plethora of documentation and it was great. It seems to be hard to find out the suggested way to do certain things for this nrf device. Might be a personal problem.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237617?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2020 08:06:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc2f0f7f-39f5-4dfa-a4d6-011458020158</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Nicholas_Nuti"]Do you have any insight on the previous problem?[/quote]
&lt;p&gt;It seems like you get errors all over the place, and not always with sensible error codes.&lt;/p&gt;
&lt;p&gt;Regarding the specific errors you mentioned in the last few posts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SAADC: Assuming you use SDK 16, there is an assert on line 522 in nrfx_saadc.c that will trigger if you try to sample without having the SAADC initialized. Is that the problem here?&lt;/li&gt;
&lt;li&gt;For the peer manager error, it may be needed to debug a bit to understand what is going on. The error is essentially an assert from the peer manger, with an unexpected error.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;None of the errors are expected, so I wonder what state your application is in. Have you based it on an example project? Which modifications did you to? What modifications lead to these problems? I you do not have progress, can you upload your full project here so that I can test on my side on a DK? Which SDK version do you use?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237545?ContentTypeID=1</link><pubDate>Mon, 02 Mar 2020 17:55:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2355e6b6-7ee1-4508-825d-cc57ae225750</guid><dc:creator>Nicholas_Nuti</dc:creator><description>&lt;p&gt;Thank you for your help Einar! I very much appreciate it.&lt;/p&gt;
&lt;p&gt;Do you have any insight on the previous problem?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237397?ContentTypeID=1</link><pubDate>Mon, 02 Mar 2020 11:16:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8121d6c-23bd-408d-a223-1a07784f2030</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Nicholas_Nuti"]Is there a simple way I can simply implement a static passkey?[/quote]
&lt;p&gt;Yes. This is essentially the same way as you implement random passkey, just that you additionally specify the passkey by configuring the SoftDevice accordingly.&lt;/p&gt;
&lt;p&gt;This will work smoothly if you take an &lt;em&gt;unmodified&lt;/em&gt; GLS example, and just add this snipped at the end of the&amp;nbsp;gap_params_init() function.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    memset(&amp;amp;opt, 0x00, sizeof(opt));
    uint8_t passkey[] = &amp;quot;123456&amp;quot;;
    opt.gap_opt.passkey.p_passkey = passkey;
    err_code = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &amp;amp;opt);
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237242?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 19:23:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b58a9d3-a6d8-4fc3-bb9d-ad4b6476f622</guid><dc:creator>Nicholas_Nuti</dc:creator><description>&lt;p&gt;I&amp;#39;m really only using this glucose example for the passkey. I don&amp;#39;t even need a random passkey; I only need a static passkey. This seems to be more trouble than it&amp;#39;s worth. Is there a simple way I can simply implement a static passkey?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237240?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 19:10:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:917429a3-4b7d-40f1-8828-b332b30870f2</guid><dc:creator>Nicholas_Nuti</dc:creator><description>&lt;p&gt;New Update on the errors as well. If I disable LESC:&lt;/p&gt;
&lt;p&gt;#define SEC_PARAM_LESC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/p&gt;
&lt;p&gt;and I pair... it seems to work fine for a short time in DEBUG mode. BUT when I go to the battery service and turn on notifications, I get another error from the SAADC:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;lt;info&amp;gt; peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Local database, action: Update&lt;br /&gt;&amp;lt;error&amp;gt; app: ERROR 3735928559 [Unknown error code] at C:\Nordic\modules\nrfx\drivers\src\nrfx_saadc.c:522&lt;br /&gt;PC at: 0x000320BB&lt;br /&gt;&amp;lt;error&amp;gt; app: End of error report&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237238?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 19:03:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:261611b5-df92-43e4-985b-0e0050387f38</guid><dc:creator>Nicholas_Nuti</dc:creator><description>&lt;p&gt;Oh, I can&amp;#39;t believe I didn&amp;#39;t have that selected... Thank you so much for your help!&lt;/p&gt;
&lt;p&gt;The error code that comes up in the terminal is:&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; peer_manager_sm: Could not perform security procedure. smd_params_reply() or smd_link_secure() returned NRF_ERROR_INVALID_ADDR. conn_handle: 0&lt;br /&gt;&amp;lt;error&amp;gt; peer_manager_handler: Unexpected fatal error occurred: error: NRF_ERROR_INVALID_ADDR&lt;br /&gt;&amp;lt;error&amp;gt; peer_manager_handler: Asserting.&lt;br /&gt;&amp;lt;error&amp;gt; app: ERROR 16 [NRF_ERROR_INVALID_ADDR] at C:\Nordic\components\ble\peer_manager\peer_manager_handler.c:294&lt;br /&gt;PC at: 0x00039F85&lt;br /&gt;&amp;lt;error&amp;gt; app: End of error report&lt;/p&gt;
&lt;p&gt;So it seems to be a connection issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237236?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 18:54:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27891228-5755-4418-b5a4-b83fe0fa92f4</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Nicholas_Nuti"]Yes, I am based on an application example. I have the settings enabled in the sdk_config, but I guess the insufficient DEBUG feedback another issue for me.[/quote]
&lt;p&gt;Yes. But getting debug logging is very good in this cases, as it typicaly points right at the problem. If you select the Debug build as shown by this image you get it right away:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-239d598765334e4db70b2f96e93f4c24/debug.png" /&gt;&lt;/p&gt;
&lt;p&gt;This does not do much, but it adds DEBUG and DEBUG_NRF to the&amp;nbsp;list of preprocessor definitions (which is what is relevant for logging), and it sets the optimization level to None, so that the behavior you see actually match the code. This is very important for making life easier when debugging.&amp;nbsp;&lt;/p&gt;
[quote user="Nicholas_Nuti"]Yes I do have something you could run on an nRF52840DK but I was wondering if there is a way I could send it to you without posting it here? I would consider this program to be &amp;quot;company-sensitive&amp;quot;.[/quote]
&lt;p&gt;Yes. You can open a new private case where you upload the code and refer to this thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237233?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 18:40:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2cec232a-926b-40d6-ae88-01b6e7cde73c</guid><dc:creator>Nicholas_Nuti</dc:creator><description>&lt;p&gt;Yes, I am based on an application example. I have the settings enabled in the sdk_config, but I guess the insufficient DEBUG feedback another issue for me.&lt;/p&gt;
&lt;p&gt;Yes I do have something you could run on an nRF52840DK but I was wondering if there is a way I could send it to you without posting it here? I would consider this program to be &amp;quot;company-sensitive&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237228?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 18:18:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a8a1361-081e-4ef8-ae4d-a1a96c2f77c9</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;call stack does indicate a failure in app_timer implementation, as you write, but it would be good to know more. The fact that only &amp;quot;Fatal error&amp;quot; is printed indicates that you are not building the debug configuration, which has more extensive logging (assuming you are basing your application on an SDK example). Can you select &amp;quot;Debug&amp;quot; from the build configuration drop-down menu, rebuild and test again? What does the log say in that case?&lt;/p&gt;
&lt;p&gt;Do you have any code that can reproduce this on a DK that I can run on my side?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237227?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 18:13:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:389a8db6-106d-4ffe-9f30-68ae9eb6e1ca</guid><dc:creator>Nicholas_Nuti</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;I understand, for I haven&amp;#39;t been able to find out which function returns the error code as well. I have logging and the RTT back-end enabled too but I&amp;#39;m not getting the location of the error. Would the call stack be of any help?&lt;/p&gt;
&lt;p&gt;&lt;img height="121" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1582913563430v1.png" width="538" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840DK error caused in app_timer2.c (error code 8)</title><link>https://devzone.nordicsemi.com/thread/237121?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 12:34:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e369de6-991b-4948-b751-c7fea6f710fd</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It is not clear to me which functions return the error code (8 =&amp;nbsp;NRF_ERROR_INVALID_STATE), and the screenshot does not show it. Can you make sure to enable logging and build select &amp;quot;Debug&amp;quot; from the build configuration drop-down? That way the exact location of the error will be printed in the log so that we can know which function returned&amp;nbsp;&lt;span&gt;NRF_ERROR_INVALID_STATE.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>