<?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>ncs gpiote interrupt issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85538/ncs-gpiote-interrupt-issue</link><description>Hi, 
 Using the SDK 17 library, i had the following code running fine: 
 
 Now i am porting it to ncs 1.9.0, i have changed the code to: 
 
 Upon running, i get the following zephr error: 
 
 (sorry, copy/paste doesnt seem to work from the nrf terminal</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Mar 2022 09:15:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85538/ncs-gpiote-interrupt-issue" /><item><title>RE: ncs gpiote interrupt issue</title><link>https://devzone.nordicsemi.com/thread/357065?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2022 09:15:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b318d695-1f1f-4b0b-b5c9-ad84dd7f08e3</guid><dc:creator>billywalton</dc:creator><description>&lt;p&gt;Yes, &lt;/p&gt;
&lt;p&gt;&lt;span&gt;NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;missed that - thanks&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ncs gpiote interrupt issue</title><link>https://devzone.nordicsemi.com/thread/357039?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2022 08:18:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20478328-4d70-4450-9bd3-e99dd0016108</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="billywalton"]seems to have stopped the exceptions, but i dont seem to get the interrupt[/quote]
&lt;p&gt;With the IRQ handler mapped, I get a single interrupt on the NET_TIMER_INTERRUPT, as the timer short is set to this:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;NRF_TIMER_SHORT_COMPARE0_STOP_MASK&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Change it to:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And it will run continuously.&lt;/p&gt;
&lt;p&gt;Did you remember to configure IO_NET_DBG pin as an 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><item><title>RE: ncs gpiote interrupt issue</title><link>https://devzone.nordicsemi.com/thread/356998?ContentTypeID=1</link><pubDate>Tue, 08 Mar 2022 22:36:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:393113a6-d3a8-4755-8039-4ae5d4c25e8c</guid><dc:creator>billywalton</dc:creator><description>&lt;p&gt;Mapping the handler using the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;IRQ_CONNECT(DT_IRQN(DT_NODELABEL(timer2)),
		    DT_IRQ(DT_NODELABEL(timer2), priority),
		    nrfx_isr, nrfx_timer_2_irq_handler, 0);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;seems to have stopped the exceptions, but i dont seem to get the interrupt&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ncs gpiote interrupt issue</title><link>https://devzone.nordicsemi.com/thread/356983?ContentTypeID=1</link><pubDate>Tue, 08 Mar 2022 18:59:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43ab2be2-e884-4cec-8a46-c9e396af805b</guid><dc:creator>billywalton</dc:creator><description>&lt;p&gt;Hi H&amp;aring;kon,&lt;/p&gt;
&lt;p&gt;Thanks for your reply&lt;/p&gt;
&lt;p&gt;After testing further, i found its actually a timer which is causing the problem, i also have the following code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void NET_TIMER_INTERRUPT(nrf_timer_event_t event_type, void* p_context)
{
	nrf_gpio_pin_toggle(IO_NET_DGB);
}


const nrfx_timer_t NET_TIMER = NRFX_TIMER_INSTANCE(2);

#define NET_SILENCE_POWER_DETECT_US	(8000ul)
static uint32_t NET_SILENCE_POWER_DETECT;

void init(void)	
{
	
	//Timer setup
	nrfx_timer_config_t timer_cfg = NRFX_TIMER_DEFAULT_CONFIG;

    timer_cfg.mode = NRF_TIMER_MODE_TIMER;
    timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;
    timer_cfg.frequency = NRF_TIMER_FREQ_8MHz;
    timer_cfg.interrupt_priority = 3; 

    err_code = nrfx_timer_init(&amp;amp;NET_TIMER, &amp;amp;timer_cfg, NET_TIMER_INTERRUPT);
    if (err_code != NRFX_SUCCESS) {
		printk(&amp;quot;Failed to init timer (err %d)\n&amp;quot;, err_code);
		return;
	}	
	
	//Reset the timer
	nrfx_timer_clear(&amp;amp;NET_TIMER);
	
	//Syncronise the start of the next packet
	NET_SILENCE_POWER_DETECT = nrfx_timer_us_to_ticks(&amp;amp;NET_TIMER, NET_SILENCE_POWER_DETECT_US);
	nrfx_timer_extended_compare(&amp;amp;NET_TIMER, NRF_TIMER_CC_CHANNEL0, (NET_SILENCE_POWER_DETECT/4), NRF_TIMER_SHORT_COMPARE0_STOP_MASK, true);
	
	//Enable Timer + External Interupt
	nrfx_timer_enable(&amp;amp;NET_TIMER);

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is the code causing the interrupt exception, the gpiote is working fine&lt;/p&gt;
&lt;p&gt;my prj.conf contains&lt;/p&gt;
&lt;div style="background-color:#1e1e1e;color:#d4d4d4;font-family:Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div&gt;&lt;span style="color:#569cd6;"&gt;CONFIG_NRFX_TIMER2&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Again, this code seems fine under the SDK 17&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Billy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ncs gpiote interrupt issue</title><link>https://devzone.nordicsemi.com/thread/356830?ContentTypeID=1</link><pubDate>Tue, 08 Mar 2022 10:21:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4abfa8be-f288-495e-b2a4-9e200a293dc2</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 simple example on how to use it, based on hello_world:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2012-2014 Wind River Systems, Inc.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;sys/printk.h&amp;gt;
#include &amp;lt;hal/nrf_gpio.h&amp;gt;
#include &amp;lt;nrfx_gpiote.h&amp;gt;

#define IO_NET_RX 13
#define LED_0 17

static void NET_INTERRUPT(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
	nrf_gpio_pin_toggle(LED_0);
}

void main(void)
{
	printk(&amp;quot;Hello World! %s\n&amp;quot;, CONFIG_BOARD);
	nrf_gpio_cfg_output(LED_0);
	uint32_t err_code;
	if (!nrfx_gpiote_is_init()){
    	err_code = nrfx_gpiote_init(2);
		if (err_code != NRFX_SUCCESS) {
			printk(&amp;quot;Failed to init gpiote (err %d)\n&amp;quot;, err_code);
			return;
		}
	}
	nrfx_gpiote_in_config_t in_config = NRFX_GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
	in_config.sense = NRF_GPIOTE_POLARITY_HITOLO;
	in_config.pull = NRF_GPIO_PIN_PULLUP;
	//in_config.hi_accuracy = true;

	err_code = nrfx_gpiote_in_init(IO_NET_RX, &amp;amp;in_config, NET_INTERRUPT);
	if (err_code != NRFX_SUCCESS) {
		printk(&amp;quot;Failed to init gpiote in (err %d)\n&amp;quot;, err_code);
		return;
	}

	nrfx_gpiote_in_event_enable(IO_NET_RX, true);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s my prj.conf:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_GPIO=y
CONFIG_NRFX_GPIOTE=y
# Comment in this if you get mpu/stack faults on the uart
# CONFIG_MAIN_STACK_SIZE=4096&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you check if this works on your end?&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>