<?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>Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67395/fatal-error-having-called-nrfx_gpiote_in_init</link><description>I&amp;#39;m new to the nrf5 GPIO functionality and having a little difficulty getting started. Upon having called `nrfx_gpiote_in_init`, my app reports a fatal error and the device resets. &amp;#39;hoping that the following code sheds some light on this: 
 ``` 
 
 /</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 20 Oct 2020 10:44:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67395/fatal-error-having-called-nrfx_gpiote_in_init" /><item><title>RE: Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/thread/275856?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 10:44:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b85a8f30-94ca-43d6-bb88-1c3c0e4b1d47</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="Christopher Hunt"]OK, turns out that the template has settings both for legacy and contemporary GPIOTE i.e.&amp;nbsp;GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS (which was set to 4) and&amp;nbsp;NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS (which was set to 1). I&amp;#39;ve now removed the legacy settings and specified a value of 5 for&amp;nbsp;&lt;span&gt;NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS (the number of buttons on the DK + 1 pin I want).&lt;/span&gt;[/quote]
&lt;p&gt;Great, I am glad to hear that you were able to resolve the issue.&lt;/p&gt;
[quote user="Christopher Hunt"]All is good in the world.[/quote]
&lt;p&gt;I am happy to hear you say that,&amp;nbsp;Christopher!&lt;/p&gt;
[quote user="Christopher Hunt"]Thanks for all of the pointers![/quote]
&lt;p&gt;It is truly no problem at all, I am happy to help! :)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Please do not hesitate to open a new ticket if you should encounter any issues or questions in the future.&lt;br /&gt;&lt;br /&gt;Good luck with your development!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/thread/275827?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 09:47:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20e2718a-89ce-4e45-a141-76c8a6e9913d</guid><dc:creator>Christopher Hunt</dc:creator><description>&lt;p&gt;OK, turns out that the template has settings both for legacy and contemporary GPIOTE i.e.&amp;nbsp;GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS (which was set to 4) and&amp;nbsp;NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS (which was set to 1). I&amp;#39;ve now removed the legacy settings and specified a value of 5 for&amp;nbsp;&lt;span&gt;NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS (the number of buttons on the DK + 1 pin I want).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;All is good in the world.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for all of the pointers!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/thread/275814?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 09:23:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e340b78d-3a3f-41d2-8c3c-e1a1068401f1</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="Christopher Hunt"]It turns out that declaring &amp;quot;high accuracy&amp;quot; for the config is required:[/quote]
&lt;p&gt;The difference between high- and low-accuracy ( PORT events ) can be read about in the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fgpiote.html"&gt;GPIOTE documentation&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;You will indeed have to specify how many low-power events ( PORT events ) your application will use, when using PORT events.&lt;br /&gt;You may use up to 8 low power events, by setting it in the configuration. This will however allocate GPIOTE channels, so you may then have less high-accuracy events in use at the same time. In your case, setting NUM_LOW_POWER to 1 should remove the NO_MEM error you saw previously.&lt;/p&gt;
[quote user="Christopher Hunt"]I thought that low accuracy equated to low power, but perhaps there&amp;#39;s a different meaning altogether?[/quote]
&lt;p&gt;Yes, you are correct here - low accuracy is PORT events, which are low power.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/thread/275811?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 09:21:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3a386df-0763-43c7-acab-848eba710261</guid><dc:creator>Christopher Hunt</dc:creator><description>&lt;p&gt;Actually, I misread the code. While it certainly works for high accuracy, low accuracy appears to require some more configuration?&amp;nbsp;&lt;span&gt;NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS does not have to be greater than&amp;nbsp;&lt;/span&gt;&lt;span&gt;GPIOTE_CH_NUM. Still a bit confused - I do want the port events for lower power...&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/thread/275803?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 09:11:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ec4b7ed-1cc3-4e30-a532-a91af77aa1cc</guid><dc:creator>Christopher Hunt</dc:creator><description>&lt;p&gt;It turns out that declaring &amp;quot;high accuracy&amp;quot; for the config is required:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;code&gt;&lt;span&gt;nrfx_gpiote_in_config_t&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;config&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;NRFX_GPIOTE_CONFIG_IN_SENSE_TOGGLE&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;true&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If I pass false (as I was) then&amp;nbsp;NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS needs to be &amp;gt;=&amp;nbsp;GPIOTE_CH_NUM.&amp;nbsp;GPIOTE_CH_NUM is set to 8 by default.&lt;/p&gt;
&lt;p&gt;There&amp;#39;s no doc I found explaining the relationship of&amp;nbsp;GPIOTE_CH_NUM. I thought that low accuracy equated to low power, but perhaps there&amp;#39;s a different meaning altogether?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/thread/275792?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 08:39:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f2834bb-d209-43fe-a8f1-ef8c387911c7</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="Christopher Hunt"]So, I&amp;#39;d say it is in the&amp;nbsp;nrfx_gpiote_in_init function.[/quote]
&lt;p&gt;Yes, this is correct. So, taking a look at the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fgroup__nrfx__gpiote.html&amp;amp;anchor=gab0c7d253c206a8a95f8b1a1db4efd08f"&gt;nrfx_gpiote_in_init function API Refernce&lt;/a&gt;&amp;nbsp;we see that:&lt;/p&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="1" rowspan="1"&gt;NRFX_ERROR_NO_MEM&lt;/td&gt;
&lt;td colspan="1" rowspan="1"&gt;No GPIOTE channel is available.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;What is your (NRFX_)GPIOTE_NUM_OF_LOW_POWER_EVENTS defined as?&lt;br /&gt;Try to increase it, to see if this resolves your error.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/thread/275777?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 07:58:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0137ca97-8120-4881-a0b8-a0d7dc897738</guid><dc:creator>Christopher Hunt</dc:creator><description>&lt;p&gt;L698 is the APP_ERROR_CHECK in the following:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;err_code&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;nrfx_gpiote_in_init&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;pir_pin1&lt;/span&gt;&lt;span&gt;, &amp;amp;&lt;/span&gt;&lt;span&gt;config&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;on_gpio_in_evt&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;APP_ERROR_CHECK&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;err_code&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;So, I&amp;#39;d say it is in the&amp;nbsp;nrfx_gpiote_in_init function.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I&amp;#39;m checking memory parameters now, but so far it looks ok. There&amp;#39;s almost 256k of RAM, so perhaps some allocator?&lt;/span&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/thread/275774?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 07:54:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48377f4e-9ba6-4b9b-b474-29a44988fcb8</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="Christopher Hunt"]Thank you Karl. [/quote]
&lt;p&gt;No problem at all, Christopher!&lt;/p&gt;
[quote user="Christopher Hunt"]This yields the following very interesting snippet:[/quote]
&lt;p&gt;Yes, this is much easier to work with.&lt;br /&gt;NRF_ERROR_NO_MEM is often returned by a function when it has insufficient allocated memory to be executed.&lt;br /&gt;Which function is being called at line 698 of your main.c?&lt;br /&gt;When we know the exact function generating the error code, we can look it up in the API Reference, to see how we should proceed with the error.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/thread/275771?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 07:49:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:240eb0ef-0666-4fac-a843-9f2e51869e22</guid><dc:creator>Christopher Hunt</dc:creator><description>&lt;p&gt;Thank you Karl. This yields the following very interesting snippet:&lt;/p&gt;
&lt;p class="p1"&gt;&lt;code&gt;&lt;span class="s1"&gt;&amp;lt;error&amp;gt; app: ERROR 4 [NRF_ERROR_NO_MEM] at ../../../main.c:698&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;code&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There&amp;#39;s obviously now some heap that I&amp;#39;ve not set up? Again, I&amp;#39;m using the BLE peripheral template.&lt;/p&gt;
&lt;p class="p1"&gt;&lt;code&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Fatal error having called nrfx_gpiote_in_init</title><link>https://devzone.nordicsemi.com/thread/275768?ContentTypeID=1</link><pubDate>Tue, 20 Oct 2020 07:43:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b7f5523-4ed9-471b-98fe-d343d88223c3</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]Not that it makes any difference here though, the failure occurs as a consequence of `&lt;span&gt;APP_ERROR_CHECK` following the `nrfx_gpiote_in_init` call.&lt;/span&gt;[/quote]
&lt;p&gt;Could you make sure that DEBUG is defined in your preprocessor defines? It should look like the included image:&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/3872.enabling_5F00_debug_5F00_SES.PNG" /&gt;&lt;br /&gt;&lt;br /&gt;Please make sure this is the case, and run the program again - you should then see a complete error message printed to the log, with which we may begin the debugging.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>