<?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>Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/64626/cannot-get-button-gpio-interrupt-on-net-cpu-using-nrf5340dk</link><description>Using just the nRF Connect SDK, I cannot get a push button to interrupt the NET CPU on the nRF5340DK. 
 
 I have the following code on the APP CPU: 
 nrf_gpio_pin_mcu_select(23, NRF_GPIO_PIN_MCUSEL_NETWORK); 
 The following code runs on the NET CPU: </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 21 Aug 2020 06:50:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/64626/cannot-get-button-gpio-interrupt-on-net-cpu-using-nrf5340dk" /><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/265649?ContentTypeID=1</link><pubDate>Fri, 21 Aug 2020 06:50:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2216be30-6d9a-4ba4-941f-b773393bbb45</guid><dc:creator>jyi</dc:creator><description>&lt;p&gt;I created a new public ticket with the FORCEOFF question. I suppose this ticket with button interrupts is now resolved. Thanks for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/265642?ContentTypeID=1</link><pubDate>Fri, 21 Aug 2020 06:15:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:017d5b25-2055-4ad7-841e-aa4e778affa3</guid><dc:creator>jyi</dc:creator><description>&lt;p&gt;Alright, I am able to get interrupts now.&amp;nbsp;The above code is fine. The issue is the NET CPU startup is not always reliable. Using the&amp;nbsp;empty_app_core project, I do not see my NET CPU startup.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When I reset the NET CPU using &amp;quot;&lt;span&gt;nrfjprog -f NRF53 --coprocessor CP_NETWORK --reset&amp;quot;, then I see the NET CPU execute my binary. And buttons presses reliably generate interrupt.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Any idea how to make the&amp;nbsp;empty_app_core reliably start my application?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/265338?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2020 13:19:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ad09708-b42c-42d6-921c-a4fcdbc86989</guid><dc:creator>jyi</dc:creator><description>&lt;p&gt;I&amp;#39;m tried something extremely basic in the reset handler. I expected to trap&amp;nbsp;in the SystemDefaultHandler() upon a button press but instead remains looping in the Reset_Handler(). I&amp;#39;m missing something basic.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void SystemDefaultHandler(void)
{
  while(1);
}

SECTION(&amp;quot;.isr_vector&amp;quot;)
void (* const systemVectors[256])(void) =
{
  (void (*)(void))(&amp;amp;__stack_top__),
  Reset_Handler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,

  /* External interrupts */
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler,
  SystemDefaultHandler

};

#include &amp;lt;nrfx_gpiote.h&amp;gt;

static void button_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
  while(1);
}

void Reset_Handler(void)
{
  /* Use linker defined location for ROM vector tables. */
  SCB-&amp;gt;VTOR = (uint32_t)systemVectors;

  /* Core initialization. */
  SystemInit();

  nrfx_gpiote_init(NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY);
  nrfx_gpiote_in_config_t cfg = NRFX_GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
  cfg.pull = NRF_GPIO_PIN_PULLUP;
  nrfx_gpiote_in_init(NRF_GPIO_PIN_MAP(0, 23), &amp;amp;cfg, button_handler);
  nrfx_gpiote_in_event_enable(NRF_GPIO_PIN_MAP(0, 23), true);

  NVIC_EnableIRQ(GPIOTE_IRQn);
  __enable_irq();

  while(1);
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/265325?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2020 12:45:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55dbea59-93a2-4ba1-917e-9991f994959a</guid><dc:creator>jyi</dc:creator><description>&lt;p&gt;These are useful links. But did not solve my problem.&lt;/p&gt;
&lt;p&gt;I think the issue is even more fundamental. I tried&amp;nbsp;a VTOR with every entry pointing to a default handler/trap, I never break on any ISR. I am setting the global interrupt&amp;nbsp;__enable_irq(). I call NVIC_EnableIRQ(GPIOTE_IRQn). And I&amp;#39;m relying on the nrfx drivers to enable IRQs. Missing anything else?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/265016?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2020 08:42:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32d6fb27-7a6e-4c6b-b57b-4b9485a26cd9</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;If you set a breakpoint in&amp;nbsp;&lt;span&gt;nrfx_gpiote_irq_handler(), and press the button, do you hit the breakpoint ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If not, make sure that you have something &lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/master/soc/nrfx_irqs_nrf5340_application.h#L95"&gt;like this&lt;/a&gt; defined,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;// GPIOTE0_IRQn
#define nrfx_gpiote_irq_handler     GPIOTE_IRQHandler&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Still not working, then you might need something &lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/master/templates/nrfx_config_nrf5340_application.h#L132"&gt;like this&lt;/a&gt;,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NRF_GPIOTE        NRF_GPIOTE0
#define GPIOTE_IRQHandler GPIOTE0_IRQHandler&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/264675?ContentTypeID=1</link><pubDate>Fri, 14 Aug 2020 19:28:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71c316fa-defa-4266-9257-2ad5582b9144</guid><dc:creator>jyi</dc:creator><description>&lt;p&gt;Sigurd,&lt;/p&gt;
&lt;p&gt;Thank you for trying this and confirming the code works. The difference in my setup is that I&amp;#39;m not using zephyr.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I did try using the empty_app_core on the APP CPU. And I tried using your NET CPU example code (removing the zephyr code) and I&amp;#39;m still not getting interrupts.&lt;/p&gt;
&lt;p&gt;My issue must have something to do with the code prior to main(). I will keep trying to see if I can resolve. But if you can point me to the zephyr startup code (e.g. Reset Handler) and/or if the ncs has a non-zephyr startup example, that would help.&lt;/p&gt;
&lt;p&gt;Appreciate your effort to help me on this issue.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;John&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/264535?ContentTypeID=1</link><pubDate>Thu, 13 Aug 2020 21:16:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:729679d5-4640-4029-880a-437a1ee3f30d</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;The following works fine here, testing on NCS v1.3.0 on a PCA10095 version 0.7.0&lt;/p&gt;
&lt;p&gt;For&amp;nbsp;&lt;span&gt;nrf5340pdk_nrf5340_cpuapp, I&amp;#39;m running the empty_app_core sample.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;On&amp;nbsp;nrf5340pdk_nrf5340_cpunet, I&amp;#39;m running this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;main.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2019 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;zephyr.h&amp;gt;

#include &amp;lt;nrfx_gpiote.h&amp;gt;

#include &amp;lt;logging/log.h&amp;gt;
LOG_MODULE_REGISTER(nrfx_sample, LOG_LEVEL_INF);

static void button_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
	LOG_INF(&amp;quot;GPIO input event callback&amp;quot;);
}

void main(void)
{
	LOG_INF(&amp;quot;nrfx_gpiote sample on %s&amp;quot;, CONFIG_BOARD);

	/* Connect GPIOTE_0 IRQ to nrfx_gpiote_irq_handler */
	IRQ_CONNECT(DT_IRQN(DT_NODELABEL(gpiote)),
		    DT_IRQ(DT_NODELABEL(gpiote), priority),
		    nrfx_isr, nrfx_gpiote_irq_handler, 0);


    nrfx_gpiote_init(NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY);
    nrfx_gpiote_in_config_t cfg = NRFX_GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
    cfg.pull = NRF_GPIO_PIN_PULLUP;
    nrfx_gpiote_in_init(NRF_GPIO_PIN_MAP(0, 23), &amp;amp;cfg, button_handler);
    nrfx_gpiote_in_event_enable(NRF_GPIO_PIN_MAP(0, 23), true);
  
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;prj.conf&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_GPIO=n
CONFIG_NRFX_GPIOTE=y
CONFIG_LOG=y
CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then when I press button 1 (pin 23) on the kit, I get &amp;quot;GPIO input event callback&amp;quot; printed in the terminal (see &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf5340.html#getting-logging-output"&gt;this link&lt;/a&gt; on how to get log-output).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/264411?ContentTypeID=1</link><pubDate>Thu, 13 Aug 2020 09:44:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1148d182-aeb2-41f8-b9fe-0e64517e0a34</guid><dc:creator>jyi</dc:creator><description>&lt;p&gt;Ahh...I missed this. I have this connected&amp;nbsp;now&amp;nbsp;but still do not get an interrupt.&lt;/p&gt;
&lt;p&gt;I verified pin configuration is correct by using&amp;nbsp;nrf_gpio_pin_read(23). I can see the return value is the correct button state. This confirms the NET CPU is in control of the pin.&lt;/p&gt;
&lt;p&gt;Now it is just a matter of getting a NET CPU interrupt on button toggle. These are the registers I verified after button push (looks correct):&lt;/p&gt;
&lt;div class="page" title="Page 226"&gt;
&lt;div class="layoutArea"&gt;
&lt;div class="column"&gt;
&lt;p&gt;&lt;span&gt;INTENSET (0x4100A304) =&amp;nbsp;0x8000000f&lt;br /&gt;&lt;/span&gt;&lt;span&gt;EVENTS_IN[0] (&lt;/span&gt;0x4100A100) = 0x1&lt;br /&gt;&lt;span&gt;EVENTS_IN[1] (&lt;/span&gt;&lt;span&gt;0x4100A104) = 0x1&lt;/span&gt;&lt;br /&gt;&lt;span&gt;EVENTS_IN[2] (&lt;/span&gt;&lt;span&gt;0x4100A108) = 0x1&lt;/span&gt;&lt;br /&gt;&lt;span&gt;EVENTS_IN[3] (&lt;/span&gt;&lt;span&gt;0x4100A10C) = 0x1&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As for connecting ISR handlers, I confirmed the vector table is setup in this manner:&lt;/p&gt;
&lt;p&gt;SCB-&amp;gt;VTOR = IrqVectors[]&lt;br /&gt;IrqVectors[26] =nrfx_gpiote_irq_handler &amp;nbsp;// 26: GPIOTE_IRQn&lt;br /&gt; NVIC_EnableIRQ(GPIOTE_IRQn);&lt;/p&gt;
&lt;p&gt;Global interrupts are enabled. Any thing else I should check?&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/264116?ContentTypeID=1</link><pubDate>Tue, 11 Aug 2020 15:44:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc8e8ee1-f3a1-4679-987e-b6014dc71dcb</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Did you connect GPIOTE_0 IRQ to nrfx_gpiote_irq_handler ?&lt;/p&gt;
&lt;p&gt;You could take a look at how it&amp;#39;s done in the Zephyr nrfx sample. See &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.3.0-rc1-ncs1/samples/boards/nrf/nrfx/src/main.c"&gt;this link&lt;/a&gt;. To test this sample, build the nrfx sample for the nrf5340pdk_nrf5340_cpunet. And for the app core, you could e.g. use the NCS&amp;nbsp;empty_app_core sample, and build that for&amp;nbsp;nrf5340pdk_nrf5340_cpuapp. See &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.3.0/samples/nrf5340/empty_app_core/src/main.c"&gt;this link&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/263874?ContentTypeID=1</link><pubDate>Mon, 10 Aug 2020 14:29:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20b3acac-061c-4563-adfc-f0a96616c5ee</guid><dc:creator>jyi</dc:creator><description>&lt;p&gt;Sigurd,&lt;/p&gt;
&lt;p&gt;Thanks for the response. However, I believe my code is already doing what you suggested. Unless I&amp;#39;m missing something, can you please elaborate?&lt;/p&gt;
&lt;p&gt;John&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot get button/gpio interrupt on NET CPU using nRF5340DK</title><link>https://devzone.nordicsemi.com/thread/263791?ContentTypeID=1</link><pubDate>Mon, 10 Aug 2020 10:39:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce6f7c9d-3ed8-49b9-b99b-c116e9fee95e</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="34549" url="~/f/nordic-q-a/64626/cannot-get-button-gpio-interrupt-on-net-cpu-using-nrf5340dk"]I cannot get a push button to interrupt the NET CPU on the nRF5340DK.[/quote]
&lt;p&gt;&lt;span&gt;By default, all pins are assigned to the application core. The application core&amp;#39;s MCUSEL bitfield in register&amp;nbsp;&lt;/span&gt;&lt;a class="xref" href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/gpio.html?cp=3_0_0_6_12_0#register.PIN_CNF"&gt;PIN_CNF[n] (n=0..31) (Retained)&lt;/a&gt;&lt;span&gt;&amp;nbsp;controls the allocation of the pins into cores, peripherals and the TaD subsystem. See &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf5340%2Fgpio.html&amp;amp;anchor=doc_multiple_mcus"&gt;this page&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In order to enable the network domain to have control of the GPIO,set the GPIO&amp;#39;s MCUSEL to NetworkMCU. You can add this to the &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.3.0-rc1-ncs1/boards/arm/nrf5340pdk_nrf5340/nrf5340_cpunet_reset.c#L30"&gt;remoteproc_mgr_config&lt;/a&gt;&lt;/span&gt;&lt;span&gt;() function, similar to how it&amp;#39;s done for the UART pins in that function.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_P0-&amp;gt;PIN_CNF[MY_PIN_NUMBER] =
	GPIO_PIN_CNF_MCUSEL_NetworkMCU &amp;lt;&amp;lt; GPIO_PIN_CNF_MCUSEL_Pos;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>