<?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>How to set gpioe to low accuracy in NCS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78041/how-to-set-gpioe-to-low-accuracy-in-ncs</link><description>Excuse me: 
 I now use NCS to develop nrf52840 applications. My applications require IO events of more than 8 channels. How should I configure them.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Aug 2021 19:27:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78041/how-to-set-gpioe-to-low-accuracy-in-ncs" /><item><title>RE: How to set gpioe to low accuracy in NCS</title><link>https://devzone.nordicsemi.com/thread/322965?ContentTypeID=1</link><pubDate>Mon, 02 Aug 2021 19:27:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecca6dda-f4f9-43be-af4a-e898e085a698</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;You can add a GPIO input interrupt with a callback using the following code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define PIN 23

void button_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
    printk(&amp;quot;Button pressed&amp;quot;);
}

void main(void)
{
    const struct device *gpio_dev;
    static struct gpio_callback button_cb_data;
    
    gpio_dev = device_get_binding(&amp;quot;GPIO_0&amp;quot;);
    gpio_pin_configure(gpio_dev, PIN, GPIO_INPUT | GPIO_PULL_UP);
    gpio_pin_interrupt_configure(gpio_dev, PIN, GPIO_INT_EDGE_TO_INACTIVE);
    gpio_init_callback(&amp;amp;button_cb_data, button_callback, BIT(PIN));
    gpio_add_callback(gpio_dev, &amp;amp;button_cb_data);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To use GPIOTE PORT event instead of GPIOTE IN event, add the following to prj.conf:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_GPIO_NRF_INT_EDGE_USING_SENSE=y&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set gpioe to low accuracy in NCS</title><link>https://devzone.nordicsemi.com/thread/322774?ContentTypeID=1</link><pubDate>Mon, 02 Aug 2021 02:40:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01e3579e-13aa-47cf-aa00-6aff12c90d4e</guid><dc:creator>helen</dc:creator><description>&lt;p&gt;&lt;span&gt;Excuse me:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I want to&amp;nbsp; use the GPIO SENSE signal which triggers the GPIOTE PORT event,&amp;nbsp;My applications require IO events of more than 8 channels. How should I configure them in NCS?thank you very much!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set gpioe to low accuracy in NCS</title><link>https://devzone.nordicsemi.com/thread/322665?ContentTypeID=1</link><pubDate>Fri, 30 Jul 2021 12:27:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b1cbec0-8474-45e1-853e-5566dc3bc070</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi, when you configure the GPIOs you can change between &lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span&gt;GPIO_INT_LEVEL_ACTIVE&lt;/span&gt;&lt;/code&gt; and &lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span&gt;GPIO_INT_EDGE_TO_ACTIVE&lt;/span&gt;&lt;/code&gt;&lt;a title="Permalink to this definition" href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/peripherals/gpio.html#c.GPIO_INT_EDGE_TO_ACTIVE"&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/peripherals/gpio.html"&gt;http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/peripherals/gpio.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span&gt;GPIO_INT_LEVEL_ACTIVE&lt;/span&gt;&lt;/code&gt;&amp;nbsp; corresponds to &amp;quot;low accuracy&amp;quot; mode in the nRF5 SDK, and &lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span&gt;GPIO_INT_EDGE_TO_ACTIVE&lt;/span&gt;&lt;/code&gt;&lt;a title="Permalink to this definition" href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/peripherals/gpio.html#c.GPIO_INT_EDGE_TO_ACTIVE"&gt;&lt;/a&gt; is &amp;quot;high accuracy&amp;quot;.&lt;/p&gt;
&lt;p&gt;Or if we are using the product specification terms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&lt;span&gt;GPIO_INT_LEVEL_ACTIVE&lt;/span&gt;&lt;/code&gt; corresponds to using the GPIO SENSE signal which triggers the GPIOTE PORT event. This does not consume any extra current and is therefore recommended for low power applications.&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span&gt;GPIO_INT_EDGE_TO_ACTIVE&lt;/span&gt;&lt;/code&gt; corresponds to using the GPIOTE IN event, which consumes current in the 10-50 uA range, depending on the chip type.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This behavior will be changed in an upcoming release, and will be using Kconfig options instead. Please have a look at this pull request: &lt;a href="https://github.com/zephyrproject-rtos/zephyr/pull/31823"&gt;https://github.com/zephyrproject-rtos/zephyr/pull/31823&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;EDIT&lt;/p&gt;
&lt;p&gt;This pull request I linked to above is already part of NCS 1.6.0 and it is possible to use the GPIOTE PORT event, a.k.a &amp;quot;low accuracy mode&amp;quot;, by just enabling this Kconfig option in prj.conf: CONFIG_GPIO_NRF_INT_EDGE_USING_SENSE=y&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>