<?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>Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114234/interrupt-energy-intensive</link><description>When I program an interrupt, the NRF52840 requires 250uA extra. I read something about the sense interrupt, but I cannot find any working example. How should I implement an interrupt when my power is on a budget? 
 
 I tried to replace gpio_pin_interrupt_configure_dt</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Aug 2024 11:35:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114234/interrupt-energy-intensive" /><item><title>RE: Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/thread/500411?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2024 11:35:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ecc7f45-550f-4a39-a4b3-4c10f6e6478b</guid><dc:creator>boris bergman1</dc:creator><description>&lt;p&gt;Thanks, this works and uses exactly the same current as GPIO_INT_LEVEL_ACTIVE.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;gpio0 {
    sense-edge-mask = &amp;lt;0xFFFFFFFF&amp;gt;; //&amp;lt;0x400&amp;gt;;
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Only, if I use 0x400 it consumes more. (pin 11)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/thread/500368?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2024 08:22:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62a357b2-1291-4237-93e3-1166d530c9dd</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I now understand the problem. I had only tested the GPIO_INT_LEVEL_ACTIVE with button presses and didn&amp;#39;t realize that it would keep firing interrupts as long as the input signal is active. The solution is to revert back to using the&amp;nbsp;&lt;span&gt;GPIO_INT_EDGE_TO_ACTIVE flag and set the &amp;#39;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/eb0a524972277a0168ffd41d7ed1111361638506/dts/bindings/gpio/nordic%2Cnrf-gpio.yaml#L17"&gt;sense-edge-mask&lt;/a&gt;&amp;#39; property in your gpio node in the devicetree to enable the sense mechanism to be used for edge detection.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/thread/500131?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2024 08:12:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d65efaa3-0b14-4ce0-9a88-d369264c3b07</guid><dc:creator>boris bergman1</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/114234/interrupt-energy-intensive/500128"]Sorry, but I&amp;#39;m not sure what you mean by this.[/quote]
&lt;p&gt;I mean my trigger signal is HIGH(1) until my function (_data_handler) reads the register of my peripheral, then it turns LOW(0).&lt;/p&gt;
&lt;p&gt;An GPIO_INT_EDGE_TO_ACTIVE trigger will only trigger once, when the signal goes from LOW to HIGH. a level trigger will trigger indefinite as long as this signal is HIGH.&lt;/p&gt;
&lt;p&gt;That&amp;#39;s the reason I turn of the trigger in my ISR (see my previous code snippet).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/thread/500128?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2024 08:06:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c60e6f82-3366-49f6-8c0e-b363bb353538</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;PORT events are used when you use the *_LEVEL_* flags with the gpio_pin_interrupt_configure_dt() function, and IN events are used when you use the *_EDGE_* flags. I don&amp;#39;t know what your input signal looks like, but are you not having this problem when using&amp;nbsp;GPIO_INT_EDGE_TO_ACTIVE?&lt;/p&gt;
[quote userid="120039" url="~/f/nordic-q-a/114234/interrupt-energy-intensive/500121"]I meant I configured my peripheral to signal 1 until _data_handler is executed.[/quote]
&lt;p&gt;Sorry, but I&amp;#39;m not sure what you mean by this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/thread/500121?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2024 07:46:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48a85bf8-6bf8-476f-a0c5-b8b81f6c2699</guid><dc:creator>boris bergman1</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/114234/interrupt-energy-intensive/500103"]&amp;#39;m also not sure I understand which hardware changes you&amp;#39;re referring to.[/quote]
&lt;p&gt;I meant I configured my peripheral to signal 1 until _data_handler is executed.&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/114234/interrupt-energy-intensive/500103"]Could you please post a snippet of your current code?[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void lsm6dsl_data_handler(struct k_work *work);
K_WORK_DELAYABLE_DEFINE(_proces, _data_handler);

void _isr(const struct device *dev, struct gpio_callback *cb, uint32_t pins) {  
  gpio_pin_interrupt_configure_dt(&amp;amp;signal, GPIO_INT_DISABLE);
  LOG_INF(&amp;quot;isr given&amp;quot;);

  k_work_schedule(&amp;amp;_proces, K_NO_WAIT); 
}

void attachinterrupt(void) {

	__ASSERT(device_is_ready(signal.port), &amp;quot;custom device not ready&amp;quot;);
	if(gpio_pin_configure_dt(&amp;amp;signal, GPIO_INPUT)) {
    LOG_ERR(&amp;quot;error configure signalgpio&amp;quot;);
  }

	if(gpio_pin_interrupt_configure_dt(&amp;amp;signal, GPIO_INT_LEVEL_HIGH)) {  //GPIO_INT_EDGE_TO_ACTIVE
    LOG_ERR(&amp;quot;error configure interrupt signalgpio&amp;quot;);
  };
	gpio_init_callback(&amp;amp;_interrupt, _isr, BIT(signal.pin));
	if(gpio_add_callback(signal.port, &amp;amp;_interrupt)) {
    LOG_ERR(&amp;quot;callback for interrupt not set&amp;quot;);
 };
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/114234/interrupt-energy-intensive/500103"]Any GPIO input enabled with sense can trigger the &lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/gpiote.html#ariaid-title3"&gt;PORT event&lt;/a&gt;.[/quote]
&lt;p&gt;I don&amp;#39;t really get how this translates to the events in Zephyr.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/thread/500103?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2024 05:46:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dc5c8c8-d5fe-4c9c-a90b-5dadc37040bf</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Are you saying that you need to clear the PORT event within your interrupt handler to prevent the interrupt from firing repeatedly?&amp;nbsp;I&amp;#39;m also not sure I understand which hardware changes you&amp;#39;re referring to. Could you please post a snippet of your current code?&lt;/p&gt;
[quote user="boris bergman1"]What triggers also belong to GPIOTE PORT event[/quote]
&lt;p&gt;Any GPIO input enabled with sense can trigger the &lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/gpiote.html#ariaid-title3"&gt;PORT event&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/thread/500001?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2024 13:00:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:608f1b93-e437-49d5-ba3b-40ac90347e2d</guid><dc:creator>boris bergman1</dc:creator><description>&lt;p&gt;Thanks, but that&amp;#39;ll only work when I configure my hardware to have a latched interrupt. &lt;span style="text-decoration:line-through;"&gt;This will cause an infinite loop, which I don&amp;#39;t know how to resolve&lt;/span&gt;. I can immidiately disable the interrupt from the ISR routine. This won&amp;#39;t ensure tough things are not executed twice. What triggers also belong to GPIOTE PORT event?&lt;/p&gt;
&lt;p&gt;It does save ~12uA, thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/thread/499900?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2024 07:45:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b89bebb-c54e-4fc6-8ccf-9438c2dc2a67</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;You may also consider enabling level triggering instead of edge triggering by replacing the GPIO_INT_EDGE_TO_ACTIVE flag with GPIO_INT_LEVEL_ACTIVE. Edge triggering uses GPIOTE IN instead of GPIOTE PORT events, which increases the idle current&amp;nbsp;to&amp;nbsp;~17 uA. PORT events are suitable for detecting lower frequency inputs.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1724744639012v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/thread/499856?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2024 20:50:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7639508e-cc3d-4f6b-9fbd-43c0e6073f13</guid><dc:creator>boris bergman1</dc:creator><description>&lt;p&gt;Thank you that was the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interrupt energy intensive</title><link>https://devzone.nordicsemi.com/thread/499831?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2024 17:46:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2aa39d10-d708-454b-92f4-cdf94097b917</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;How much time does the pin spend high? I only ask as the pull-down is about 13k0 and 3.3V @ 13k = 250uA&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>