<?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>GPIO event shall increment counter without CPU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123288/gpio-event-shall-increment-counter-without-cpu</link><description>Hi, 
 using SDK 3.0.2 and build for the *ns target. 
 The idea is to put the CPU to sleep and while it is sleeping GPIO events (e.g. button press) shall increment a counter. Once CPU wakes up it gets the counter value and processes it. 
 Therefore I want</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Aug 2025 14:12:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123288/gpio-event-shall-increment-counter-without-cpu" /><item><title>RE: GPIO event shall increment counter without CPU</title><link>https://devzone.nordicsemi.com/thread/544351?ContentTypeID=1</link><pubDate>Fri, 01 Aug 2025 14:12:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e11a467e-78b0-4482-b98a-6dfe1b3aeb62</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="Artnia"]&lt;p&gt;First of all it doesn&amp;#39;t build:&lt;br /&gt;&lt;br /&gt;-&amp;nbsp;/src/modules/network/network.c:16:30: error: &amp;#39;CONFIG_MQTT_SAMPLE_NETWORK_LOG_LEVEL&amp;#39; undeclared here (not in a function); did you mean &amp;#39;CONFIG_MQTT_SAMPLE_ERROR_LOG_LEVEL&amp;#39;?&lt;/p&gt;
&lt;p&gt;-&amp;nbsp;/src/modules/network/network.c:110:17: error: &amp;#39;CONFIG_MQTT_SAMPLE_NETWORK_THREAD_STACK_SIZE&amp;#39; undeclared here (not in a function); did you mean &amp;#39;CONFIG_MQTT_SAMPLE_SAMPLER_THREAD_STACK_SIZE&amp;#39;?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;It is hard to say what has happened here, have you done any changes to the project?&lt;/p&gt;
&lt;p&gt;First, try to delete your build folder and regenerate the build.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The API has been changed for nrfx_gpiote_init function. Instead of:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfx_gpiote_init(NULL, 0);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You need to provide the instance:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfx_gpiote_t const gpiote_inst = NRFX_GPIOTE_INSTANCE(GPIOTE_INST_IDX);
status = nrfx_gpiote_init(&amp;amp;gpiote_inst, NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Where 0 is for secure, and 1 is for non-secure:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf9160/page/gpiote.html#d558e286"&gt;https://docs.nordicsemi.com/bundle/ps_nrf9160/page/gpiote.html#d558e286&lt;/a&gt;&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><item><title>RE: GPIO event shall increment counter without CPU</title><link>https://devzone.nordicsemi.com/thread/544177?ContentTypeID=1</link><pubDate>Thu, 31 Jul 2025 08:14:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3cb2a1ac-9851-4e6b-b939-03cb4f51fc35</guid><dc:creator>Artnia</dc:creator><description>&lt;p&gt;1. As a base for a minimal sample I use /home/art/ncs/v3.0.2/nrf/samples/net/mqtt &lt;span style="font-size:inherit;"&gt;for&amp;nbsp;nrf9160dk/nrf9160/ns&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Usually is says on boot:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting nRF Connect SDK v2.8.0-a2386bfc8401 ***
*** Using Zephyr OS v3.7.99-0bc3393fb112 ***
[00:00:00.395,111] &amp;lt;inf&amp;gt; network: Bringing network interface up and connecting to the network&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;First of all it doesn&amp;#39;t build:&lt;br /&gt;&lt;br /&gt;-&amp;nbsp;/src/modules/network/network.c:16:30: error: &amp;#39;CONFIG_MQTT_SAMPLE_NETWORK_LOG_LEVEL&amp;#39; undeclared here (not in a function); did you mean &amp;#39;CONFIG_MQTT_SAMPLE_ERROR_LOG_LEVEL&amp;#39;?&lt;/p&gt;
&lt;p&gt;-&amp;nbsp;/src/modules/network/network.c:110:17: error: &amp;#39;CONFIG_MQTT_SAMPLE_NETWORK_THREAD_STACK_SIZE&amp;#39; undeclared here (not in a function); did you mean &amp;#39;CONFIG_MQTT_SAMPLE_SAMPLER_THREAD_STACK_SIZE&amp;#39;?&lt;/p&gt;
&lt;p&gt;When I replace both with a hard coded value it builds.&lt;br /&gt;Inside the trigger task I add line 14+15&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void trigger_task(void)
{
#if CONFIG_DK_LIBRARY
	int err = dk_buttons_init(button_handler);

	if (err) {
		LOG_ERR(&amp;quot;dk_buttons_init, error: %d&amp;quot;, err);
		SEND_FATAL_ERROR();
		return;
	}
#endif /* CONFIG_DK_LIBRARY */


	nrfx_gpiote_init(NULL, 0);
	LOG_INF(&amp;quot;GPIOTE initialized&amp;quot;);

	while (true) {
		message_send();
		k_sleep(K_SECONDS(CONFIG_MQTT_SAMPLE_TRIGGER_TIMEOUT_SECONDS));
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and the behaviour is that nothing is printed.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2. If I do the same for hello_world it seems to work:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{
	printf(&amp;quot;Hello World! %s\n&amp;quot;, CONFIG_BOARD_TARGET);

	nrfx_gpiote_init(NULL, 0);

	printf(&amp;quot;GPIOTE initialized successfully.\n&amp;quot;);

	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;All pins have been configured as non-secure
Booting TF-M v2.1.1-ncs4-2
[Sec Thread] Secure image initializing!
*** Booting nRF Connect SDK v3.0.2-89ba1294ac9b ***
*** Using Zephyr OS v4.0.99-f791c49f492c ***
Hello World! nrf9160dk@0.14.0/nrf9160/ns
GPIOTE initialized successfully.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;3. According to&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf9160/page/gpiote.html#d558e286"&gt;https://docs.nordicsemi.com/bundle/ps_nrf9160/page/gpiote.html#d558e286&lt;/a&gt;&lt;br /&gt;which one (GPIOTE0 or GPIOTE1) should I be using in my application if ns/TFM is enabled? And does ns/TFM also use one of them?&lt;br /&gt;&lt;a id="" href="https://docs.nordicsemi.com/bundle/ps_nrf9160/page/dppi.html"&gt;https://docs.nordicsemi.com/bundle/ps_nrf9160/page/dppi.html&lt;/a&gt;&amp;nbsp;is also related&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO event shall increment counter without CPU</title><link>https://devzone.nordicsemi.com/thread/544165?ContentTypeID=1</link><pubDate>Thu, 31 Jul 2025 06:01:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c3ff427-9ed3-4832-baac-501084b5d670</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;
&lt;p&gt;Could you try to place your logic in a minimal sample, like zephyr/samples/hello_world or similar, then see if the gpiote/ppi/timer logic runs as expected?&lt;/p&gt;
[quote user="Artnia"]When I try to build path/to/ncs/modules/hal/nordic/nrfx/samples/src/nrfx_gppi without any modification but just the build config:[/quote]
&lt;p&gt;Inside that folder there are two samples. You could look at both to see which one is closest to your use-case.&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><item><title>RE: GPIO event shall increment counter without CPU</title><link>https://devzone.nordicsemi.com/thread/544141?ContentTypeID=1</link><pubDate>Wed, 30 Jul 2025 17:42:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:131f4085-4cad-40a1-8960-3335f3182394</guid><dc:creator>Artnia</dc:creator><description>&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Hi,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;1. For the build without ns I get:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;/ncs/v3.0.2/nrf/lib/at_monitor/at_monitor.c:11:10: fatal error: nrf_modem_at.h: No such file or directory&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;&lt;br /&gt;&lt;br /&gt;2. When I build for ns and comment the function &lt;em&gt;button_hw_counter_init() which i posted above,&amp;nbsp;&lt;/em&gt;it boots without error. But obviously I need that function.&lt;br /&gt;&lt;br /&gt;If I shrink the function to&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;void button_hw_counter_init(void)
{
	nrfx_gpiote_init(NULL, 0);
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;the behaviour is the same. So it already crashed here. Is GPIOTE already used by TFM and hence not available for me?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;I build upton the pp_modules example.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;3. When I try to build path/to/ncs/modules/hal/nordic/nrfx/samples/src/nrfx_gppi without any modification but just the build config:&lt;br /&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/pastedimage1753901121806v1.png" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;I get:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;CMake Error at CMakeLists.txt:11 (GET_DEVICE_CONFIG_FILES):
  GET_DEVICE_CONFIG_FILES Macro invoked with incorrect arguments for macro
  named: GET_DEVICE_CONFIG_FILES&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;while&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;cmake_minimum_required(VERSION 3.20.0)

if(DEFINED CUSTOM_BOILERPLATE)
    include(${CUSTOM_BOILERPLATE})
    return()
endif()

set(COMMON_PATH ${CMAKE_CURRENT_LIST_DIR}/common)
include(${COMMON_PATH}/common.cmake)

GET_DEVICE_CONFIG_FILES(${BOARD} boards)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(one_to_one)
target_sources(app PRIVATE main.c)
target_include_directories(app PRIVATE common)
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;If i fix the error by&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;# GET_DEVICE_CONFIG_FILES(${BOARD} boards)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;I can build for nrf9160dk/nrf9160 but not for&amp;nbsp;nrf9160dk/nrf9160/ns:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ncs/v3.0.2/modules/hal/nordic/nrfx/drivers/include/nrfx_gpiote.h:183:57: error: &amp;#39;nrfx_gpiote_0_irq_handler&amp;#39; undeclared (first use in this function); did you mean &amp;#39;nrfx_timer_0_irq_handler&amp;#39;?

/ncs/v3.0.2/modules/hal/nordic/nrfx/drivers/include/nrfx_gpiote.h:76:33: error: &amp;#39;NRFX_GPIOTE0_INST_IDX&amp;#39; undeclared (first use in this function); did you mean &amp;#39;NRFX_TIMER0_INST_IDX&amp;#39;?&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIO event shall increment counter without CPU</title><link>https://devzone.nordicsemi.com/thread/543780?ContentTypeID=1</link><pubDate>Mon, 28 Jul 2025 14:45:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19651f31-0502-4665-adc5-7e1377d4fe48</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;
&lt;p&gt;Here&amp;#39;s a sample that uses gpiote + timer + dppi to measure a edge:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/104771/best-way-to-measure-time-between-falling-rising-edges-ncs-zephyr-nrf52840"&gt;Best way to measure time between falling/rising edges (NCS, Zephyr, NRF52840)&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There are also samples in the nrfx folder which could be of interest for you:&lt;/p&gt;
&lt;p&gt;path/to/ncs/modules/hal/nordic/nrfx/samples/src/nrfx_gppi&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Since you are seeing a fault condition, I would recommend that you run this sample isolated for testing purposes, for board nrf9160dk/nrf9160 (note the lack of /ns), and see if this fault still occurs. If the fault still occurs, please share the output.&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>