<?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>NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/62147/nrf52840-latch-always-set-no-matter-which-pin-causes-the-wake-up</link><description>Hi I&amp;#39;m using the PCA10056 DK and ran into an issue. I can configure the nrf52 to wake up using input pins(although some pins can&amp;#39;t wake it up for some reason), however, when it wakes up, all the bits that correspond to pins that can wake up the MCU is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 12 Jun 2020 13:50:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/62147/nrf52840-latch-always-set-no-matter-which-pin-causes-the-wake-up" /><item><title>RE: NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/thread/254762?ContentTypeID=1</link><pubDate>Fri, 12 Jun 2020 13:50:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b45b30a3-89f8-426c-8c5b-34d686b883f5</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="kd123"]thank you for your dedication so far in this issue.[/quote]
&lt;p&gt;No problem at all, I am happy to help and I hope we will be able to resolve this issue together soon.&lt;/p&gt;
[quote user="kd123"]I think so too but upon inspection of the nrfx_gpiote_in_init function, nrf_gpio_cfg_input is called before configuring SENSE so I think that should be correct.[/quote][quote user="kd123"]I&amp;#39;m using the nRF5 SDK v16.0.0[/quote]
&lt;p&gt;Yes, this is implemented in the SDK v16.&lt;/p&gt;
[quote user="kd123"]Also, just to be sure the PULLUP wasn&amp;#39;t causing issue, I used NRF_GPIO_PIN_NOPULL instead and added external PULLUP and when waking up and reading the values of the wake pins, it consistently shows that only one pin is LOW.[/quote]
&lt;p&gt;Could you confirm for me the current pin configuration you are using? - exactly what are the content of their registers upon wakeup? Which is the one pin that is always low upon wakeup, and which are the ones always high?&lt;br /&gt;Going back to the code you posted in main, I notice that you are using p0.13 for the reset.&lt;br /&gt;Could you confirm for me that you have cut &lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrf52840_dk/UG/nrf52840_DK/hw_buttons_leds.html"&gt;SolderBridge 5&lt;/a&gt;&amp;nbsp;to disconnect LED1?&lt;br /&gt;Did you make any changes for p0.09 and p0.10, which is connected to the NFC antenna - did you change pins, or did you make changes to the hardware instead?&lt;/p&gt;
[quote user="kd123"]I think that if the issue with LATCH can&amp;#39;t be resolved then quickly reading the pin values when waking up could be the alternative, although I would prefer the LATCH since the pin value could theoretically already changed before the MCU can read it.[/quote]
&lt;p&gt;That might be an alternative solution, but I hope we will be able to resolve this in time for the LATCH to be used as expected.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/thread/254585?ContentTypeID=1</link><pubDate>Fri, 12 Jun 2020 04:18:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e953b449-9a5e-4475-b2db-c0905498c809</guid><dc:creator>kd123</dc:creator><description>&lt;p&gt;Hi, thank you for your dedication so far in this issue.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/62147/nrf52840-latch-always-set-no-matter-which-pin-causes-the-wake-up/254502"]I still suspect that the &lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev2/ERR/nRF52840/Rev2/latest/anomaly_840_210.html"&gt;210 Errata for the nRF52840&lt;/a&gt;&amp;nbsp;is at the heart of this issue.[/quote]
&lt;p&gt;I think so too but upon inspection of the nrfx_gpiote_in_init function, nrf_gpio_cfg_input is called before configuring SENSE so I think that should be correct.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/62147/nrf52840-latch-always-set-no-matter-which-pin-causes-the-wake-up/254502"]which SDK version are you using?[/quote]
&lt;p&gt;I&amp;#39;m using the nRF5 SDK v16.0.0&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, just to be sure the PULLUP wasn&amp;#39;t causing issue, I used NRF_GPIO_PIN_NOPULL instead and added external PULLUP and when waking up and reading the values of the wake pins, it consistently shows that only one pin is LOW. I think that if the issue with LATCH can&amp;#39;t be resolved then quickly reading the pin values when waking up could be the alternative, although I would prefer the LATCH since the pin value could theoretically already changed before the MCU can read it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/thread/254502?ContentTypeID=1</link><pubDate>Thu, 11 Jun 2020 13:02:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca92ce5d-380d-4366-b9ef-e8c435e9c77f</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again,&lt;br /&gt;&lt;br /&gt;I still suspect that the &lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev2/ERR/nRF52840/Rev2/latest/anomaly_840_210.html"&gt;210 Errata for the nRF52840&lt;/a&gt;&amp;nbsp;is at the heart of this issue.&lt;br /&gt;Seeing as you use the nrf_gpiote library to configure your pins, which SDK version are you using?&lt;br /&gt;&lt;br /&gt;I do not know if the code you posted in your initial ticket is still valid, but as the workaround specified in the Errata mentions, you will need to configure the pins as INPUT before configuring them to SENSE. I am not able to see where you have implemented this right off the bat. Could you ensure that the workaround is in place?&lt;/p&gt;
[quote user="kd123"]The pins are all in their PULLUP state before going to sleep, the MCU doesn&amp;#39;t wake up again until a button is pressed.[/quote]
&lt;p&gt;When waking up from SYSTEM_OFF all registers will be reverted to their &amp;quot;reset&amp;quot; value, as specified in the register documentation. For the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fgpio.html&amp;amp;anchor=register.PIN_CNF-0-31"&gt;GPIO CNF&lt;/a&gt; this is &amp;quot;&lt;span&gt;Reset 0x00000002&amp;quot;, or Disconnected input without input buffer nor pull, as indicated on the register documentations top left corner.&lt;/span&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/thread/254331?ContentTypeID=1</link><pubDate>Wed, 10 Jun 2020 19:07:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:536350b8-7683-4619-b218-99ab48db41ab</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Sorry for my late reply, I have been out of office due to travel.&lt;br /&gt;I will come back to you tomorrow regarding this.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/thread/253885?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2020 18:31:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f9467de-8f80-499e-aaf8-5cfcebd36ae3</guid><dc:creator>kd123</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have verified that the LATCH register is all 0 before going to sleep. The pins are all in their PULLUP state before going to sleep, the MCU doesn&amp;#39;t wake up again until a button is pressed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/thread/253809?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2020 13:11:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7afc23b-1d83-4f14-ad0a-4dfe298255d1</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="kd123"]Thank you, I wasn&amp;#39;t aware that those pins were used for the QSPI.[/quote]
&lt;p&gt;No problem at all. They are quick to overlook!&amp;nbsp;&lt;/p&gt;
[quote user="kd123"]This is for waking up from a SYSTEM_OFF. I don&amp;#39;t do the register manipulation directly but used the nrf sdk functions for it, do you think that could cause it? I also clear the latch register as recommended before every sleep.[/quote]
&lt;p&gt;I do not think that the use of nrf sdk functions would cause this, but I am not personally familiar with using them as part of a cpp program - though I do not suppose that should matter.&lt;br /&gt;&lt;br /&gt;Could you verify that the DETECT signal is in fact low before the clearing of the latch register?&lt;br /&gt;What is the value of the LATCH register before and after the clearing operation?&lt;br /&gt;An exempt from the documentation reads:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If the CPU performs a clear operation on a bit in the LATCH register when the associated PINx.DETECT signal is high, the bit in the LATCH register will not be cleared.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;By the way, have you seen &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/42399/understanding-how-the-detect-signal-works-and-how-to-clear-it/165223#165223"&gt;the reply by my colleague to this ticket&lt;/a&gt;?&lt;br /&gt;&lt;br /&gt;Looking forward to solving this issue together,&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/thread/253604?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2020 17:41:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4716d8fa-b0ec-4669-a596-5f29dd4abea3</guid><dc:creator>kd123</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/62147/nrf52840-latch-always-set-no-matter-which-pin-causes-the-wake-up/253483"]You should see the &lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrf52840_dk/UG/nrf52840_DK/solder_bridge.html"&gt;Solder Bridge Configuration documentation&lt;/a&gt; for more information about the solder bridges on the nRF52840 DK[/quote]
&lt;p&gt;Thank you, I wasn&amp;#39;t aware that those pins were used for the QSPI.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/62147/nrf52840-latch-always-set-no-matter-which-pin-causes-the-wake-up/253483"]When you say wakes up, what sleepmode are you referring to? SYSTEM_OFF or a SYSTEM_ON_*?&lt;br /&gt;Have you seen &lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev2/ERR/nRF52840/Rev2/latest/anomaly_840_210.html"&gt;this errata for the nRF52840&lt;/a&gt;? It might be what you are experiencing, in combination with the need to explicitly clear LATCH registers. An exempt from the documentation reads:&lt;br /&gt;[/quote]
&lt;p&gt;This is for waking up from a SYSTEM_OFF. I don&amp;#39;t do the register manipulation directly but used the nrf sdk functions for it, do you think that could cause it? I also clear the latch register as recommended before every sleep. This is how I initialize the GPIO and clear the latch register as well as sleep, the full code should be in the main post:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(false);
in_config.pull                       = NRF_GPIO_PIN_PULLUP;
const auto err_code = nrf_drv_gpiote_in_init(USER_INPUT_PIN, &amp;amp;in_config, nullptr);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_disable(USER_INPUT_PIN);

NRF_GPIO-&amp;gt;LATCH = NRF_GPIO-&amp;gt;LATCH;

// ...

nrf_drv_gpiote_in_event_enable(USER_INPUT_PIN, true);

sd_power_system_off(); // sleep&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/thread/253483?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2020 09:56:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c6603e6-7483-44e4-95d1-3ce6ef0e4c16</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="kd123"]Thank you for the fast response.[/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="kd123"](I have attempted to use pin 20, 22 of port 0 to wake it up before but doesn&amp;#39;t work)[/quote]
&lt;p&gt;Did you check the pins configuration on the DK? If you see the back of the DK, they are by default wired for the QSPI peripheral. You should see the &lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrf52840_dk/UG/nrf52840_DK/solder_bridge.html"&gt;Solder Bridge Configuration documentation&lt;/a&gt; for more information about the solder bridges on the nRF52840 DK.&amp;nbsp;&lt;/p&gt;
[quote user="kd123"]When the processor wakes up the value of the latch register is always 0x200C instead of just having one bit set for the pin that wakes it up(for example, 0x0004 for pin 2 causing the wake up).[/quote]
&lt;p&gt;When you say wakes up, what sleepmode are you referring to? SYSTEM_OFF or a SYSTEM_ON_*?&lt;br /&gt;Have you seen &lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev2/ERR/nRF52840/Rev2/latest/anomaly_840_210.html"&gt;this errata for the nRF52840&lt;/a&gt;? It might be what you are experiencing, in combination with the need to explicitly clear LATCH registers. An exempt from the documentation reads:&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;nbsp;The LATCH register will only be cleared if the CPU explicitly clears it by writing a &amp;#39;1&amp;#39; to the bit that shall be cleared, i.e. the LATCH register will not be affected by a PINx.DETECT signal being set low.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/thread/253374?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2020 17:26:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7112d92-77d1-4b7f-b2fa-33d64d272aaf</guid><dc:creator>kd123</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for the fast response. I&amp;#39;m using pin 2, 3, 13 of port 0 to wake up the processor(I have attempted to use pin 20, 22 of port 0 to wake it up before but doesn&amp;#39;t work). When the processor wakes up the value of the latch register is always 0x200C instead of just having one bit set for the pin that wakes it up(for example, 0x0004 for pin 2 causing the wake up).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 LATCH always set no matter which pin causes the wake up</title><link>https://devzone.nordicsemi.com/thread/253286?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2020 12:22:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b06c679-50a0-472c-833f-d9716404b96f</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""](although some pins can&amp;#39;t wake it up for some reason)[/quote]
&lt;p&gt;Did you confer with the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fpin.html"&gt;Pin Assignment for the nRF52840 SoC&lt;/a&gt;&amp;nbsp;before choosing which pins to use?&lt;br /&gt;For example, the pins &lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrf52840_dk/UG/nrf52840_DK/hw_nfc_if.html"&gt;0.09 and 0.10 are connected to the NFC antenna by default&lt;/a&gt;. You may use these, but it would require some hardware changes.&lt;br /&gt;Which other pins did you attempt to use for the reset?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user=""]when it wakes up, all the bits that correspond to pins that can wake up the MCU is set no matter which pin actually causes it.[/quote]
&lt;p&gt;Please elaborate on what bits you are referring to, and how this differs from your expectations.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>