<?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>Proper configuration of GPIO IRQ on nRF52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108634/proper-configuration-of-gpio-irq-on-nrf52</link><description>Hi, 
 I&amp;#39;m trying to setup a &amp;quot;proper&amp;quot; configuration of IRQ from external GPIOs on nRF52832, using the Zephyr GPIO API. Ambition is to keep the SoC in &amp;quot;System ON&amp;quot; mode consuming a few uAs, but I&amp;#39;m not able to find any good examples of this configurations</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 Mar 2024 09:54:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108634/proper-configuration-of-gpio-irq-on-nrf52" /><item><title>RE: Proper configuration of GPIO IRQ on nRF52</title><link>https://devzone.nordicsemi.com/thread/472884?ContentTypeID=1</link><pubDate>Fri, 08 Mar 2024 09:54:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ff9bb39-4357-4ba2-b389-dcccf7f5ecfa</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Glad I could help Daniel, the best of luck with your project &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper configuration of GPIO IRQ on nRF52</title><link>https://devzone.nordicsemi.com/thread/472830?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2024 20:52:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fcac743-a226-4c6e-afd5-7b739df6ad04</guid><dc:creator>dnil-daniel</dc:creator><description>&lt;p&gt;Thanks for providing a clear and comprehensive answer to this question, appreciated!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper configuration of GPIO IRQ on nRF52</title><link>https://devzone.nordicsemi.com/thread/472203?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2024 10:23:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0139f584-43ea-4b02-8958-f876d1cf7aa5</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Daniel&lt;/p&gt;
&lt;p&gt;Håkon is currently unavailable, and I will help you out in the mean time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Essentially the problem is the errata you point to, yes. By default the GPIO driver will use GPIOTE IN events for handling interrupts (callbacks), and because of this errata issue the sleep current in this case will not be in the single digit microamp range anymore. The solution is to add the sense-edge-mask property, which will make the GPIO driver use the GPIOTE PORT event rather than dedicated GPIOTE IN channels.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can read more about the PORT event in the documentation &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/gpiote.html?cp=5_2_0_20_1#concept_jyp_21x_lr"&gt;here&lt;/a&gt;. Essentially this event can be enabled on any pin and is not limited by the number of GPIOTE channels, but whenever the event is triggered the GPIO driver needs to check the state of the GPIO registers to verify which of the enabled pins actually changed (since you no longer get a dedicated event for each pin). Using the PORT event bypasses the GPIOTE IN channel issue and means you will get significantly lower current consumption in sleep.&amp;nbsp;&lt;/p&gt;
[quote user="dnil-daniel"]What I&amp;#39;d like to know is what is the current (as of&amp;nbsp;nRF Connect SDK 2.5.x) supported and recommended way to setup edge triggered IRQs on external pins on the nRF52 SoC using the Zephyr API?&amp;nbsp;[/quote]
&lt;p&gt;You can look at standard Zephyr samples, such as the &lt;a href="https://docs.zephyrproject.org/latest/samples/basic/button/README.html"&gt;basic button sample&lt;/a&gt;, and add the sense-edge-mask property.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;span&gt;Maybe related question, on this nRF52832 SoC it doesn&amp;#39;t seem possible to enable PM via &amp;quot;&lt;/span&gt;&lt;span&gt;CONFIG_PM=y&amp;quot; since the SoC does not set the &amp;quot;HAS_PM&amp;quot; flag. Is PM and/or PM_DEVICE supported on the nRF SoCs, can drivers add hooks here for additional power savings?&lt;/span&gt;[/quote]
&lt;p&gt;PM is not supported in the nRF devices for the simple reason that the power management system in most nRF devices is quite simple: Whenever you are not doing anything (ie the idle thread is running) the system will automatically put you in system on idle sleep mode, and this mode will not prevent any other peripherals in the system from running, so there is no need to&amp;nbsp;use the PM module to set up complex policies or other rules to handle power management.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The critical aspect of this system though is that the sleep currents depend on whichever peripherals are running,&amp;nbsp;so while the system is simple in use it does put some responsibility on the application developer to not leave peripherals running if they are not used.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The PM_DEVICE and PM_DEVICE_RUNTIME are supported by some of the peripheral drivers and can be used to put peripherals in sleep when they are not needed, which is critical to achieve low average currents when&amp;nbsp;peripherals are in use.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;PM_DEVICE allows you to disable&amp;nbsp;device drivers in a standardized way, and can as an example be used to disable the UART when it is not used, since keeping the UART driver running will lead to very high sleep currents.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;PM_DEVICE_RUNTIME is used by some drivers to handle power management in an automatic way, and if you use I2C device for instance it is highly recommended to enable this. Then the I2C peripheral will be automatically put to sleep whenever no I2C transactions are running.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper configuration of GPIO IRQ on nRF52</title><link>https://devzone.nordicsemi.com/thread/470807?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 15:33:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba7fa2bf-6557-4c2a-8456-23db3ff648f0</guid><dc:creator>dnil-daniel</dc:creator><description>&lt;p&gt;Current is measured using an Agilent 34401A DMM on both the custom hardware and on the nRF52 DK eval board, I get the expected current after enabling the&amp;nbsp;&lt;span&gt;&amp;quot;sense-edge-mask&amp;quot; property to the issue is not with the actual measurement. Custom hardware also gives expected current consumption after enabling&amp;nbsp;&amp;quot;sense-edge-mask&amp;quot;, but in this case I need to enable it on more pins since the custom hardware has a more complex setup with several external sensors configured to send IRQs to nrf52.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What I&amp;#39;m trying to understand is the correct setup on the Zephyr API-level for nRF52 and external IRQs. This bug seems relevant:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a id="" href="https://github.com/zephyrproject-rtos/zephyr/issues/28499"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/28499&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Seems that at the bottom of this is this anomaly:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52832_Rev2%2FERR%2FnRF52832%2FRev2%2Flatest%2Fanomaly_832_97.html"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52832_Rev2%2FERR%2FnRF52832%2FRev2%2Flatest%2Fanomaly_832_97.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Zephyr GPIO API seems to be using&amp;nbsp;GPIOTE channels which are affected by&amp;nbsp;anomaly 97.&amp;nbsp;&amp;quot;sense-edge-mask&amp;quot; appears to use GPIO sense instead of GPIOTE, is that correct? Somewhere here is also GPIO PORT events mentioned, how are those related? Many hours googling and testing various old and new bits of information here...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What I&amp;#39;d like to know is what is the current (as of&amp;nbsp;nRF Connect SDK 2.5.x) supported and recommended way to setup edge triggered IRQs on external pins on the nRF52 SoC using the Zephyr API?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please also comment on my questions regaring CONFIG_PM?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proper configuration of GPIO IRQ on nRF52</title><link>https://devzone.nordicsemi.com/thread/470783?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 14:32:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e2fe68f-eecf-4641-8132-eb478fbafbdd</guid><dc:creator>helsing</dc:creator><description>&lt;p&gt;Hi Daniel,&lt;/p&gt;
[quote user=""]this works but results in high current consumption of the SoC.[/quote]
&lt;p&gt;How do you measure the current?&lt;/p&gt;
[quote user=""]on the real target hardware[/quote]
&lt;p&gt;Has anyone at Nordic reviewed your custom hardware? We can review the Nordic related part of the design as a free service.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>