<?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>The GPIO4 could not read the IO level accurately in sense mode.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89698/the-gpio4-could-not-read-the-io-level-accurately-in-sense-mode</link><description>Hi Nordic 
 I used the nrf_gpio_cfg_sense_input() API to initialize the GPIO4 for waking up nrf52832 from system off mode, This IO could wake up nrf52832 successfully, but It could not be read accurately when I called nrf_gpio_pin_read() API to read in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 Jul 2022 12:22:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89698/the-gpio4-could-not-read-the-io-level-accurately-in-sense-mode" /><item><title>RE: The GPIO4 could not read the IO level accurately in sense mode.</title><link>https://devzone.nordicsemi.com/thread/376206?ContentTypeID=1</link><pubDate>Fri, 08 Jul 2022 12:22:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd5a1443-dc5f-4564-9e37-7858b9e3f78a</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for clarifying and elaborating on your project and intentions.&lt;/p&gt;
[quote user="Tom.Fu"]I called nrf_gpio_cfg_sense_input() API exclusively&amp;nbsp;to&amp;nbsp;initialize&amp;nbsp; the GPIO4&amp;nbsp;at&amp;nbsp;the beginning of the main(),It can not read the GPIO4 input level&amp;nbsp;accurately by the nrf_gpio_pin_read().Could the input level to the GPIO4 be read accurately&amp;nbsp; when GPIO4 in the sense mode?[/quote]
&lt;p&gt;Yes, it can be used for this, but the difference lies in how you configure and use it. Have you set pullups/pulldowns for the pin?&lt;br /&gt;For instance, if you need events and tasks on the GPIO you will need to enable the GPIOTE module to do so.&lt;br /&gt;&lt;br /&gt;Otherwise, you will only have &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/gpio.html?cp=4_2_0_19#concept_zyt_tcb_lr"&gt;the GPIO functionality as described here in the documentation&lt;/a&gt;.&lt;br /&gt;In this case, if you are reading the latched value of the pin you must clear it using the CPU to set to back to low, as stated in the documentation:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;&lt;span&gt;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;/em&gt;&lt;/p&gt;
[quote user="Tom.Fu"]All in all, I want the GPIO4 can be used as a wakeup source and to read the level of the pin and not to effect the DFU. If the input voltage level to GPIO4 can be read by calling&amp;nbsp;nrf_gpio_pin_read() when GPIO4 is initialized&amp;nbsp;exclusively by&amp;nbsp;nrf_gpio_cfg_sense_input(), I think this issue would be solved.[/quote]
&lt;p&gt;I would recommend that you then follow the approach used in the ble_peripheral examples - at the beginning of your application you configure the GPIO as you need it during regular operation (as a pulled down pin that you read and clear so and so often), and then you re-configure it as a wakeup pin right before going to SYSTEM_OFF sleep (usually shown in the &lt;em&gt;prepare sleep&lt;/em&gt; functions).&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: The GPIO4 could not read the IO level accurately in sense mode.</title><link>https://devzone.nordicsemi.com/thread/375907?ContentTypeID=1</link><pubDate>Thu, 07 Jul 2022 03:36:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19f7aa86-ad69-4f3a-b32e-2ddb7e228f68</guid><dc:creator>Tom.Fu</dc:creator><description>&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you confirm whether you are using the nRF Connect SDK or the nRF5 SDK for your application?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am using nRF5 SDK v17.0.2 for the application.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you also tell me, where do you initialize the GPIO to function as a wakeup source?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I called nrf_gpio_cfg_sense_input() API exclusively&amp;nbsp;to&amp;nbsp;initialize&amp;nbsp; the GPIO4&amp;nbsp;at&amp;nbsp;the beginning of the main(),It can not read the GPIO4 input level&amp;nbsp;accurately by the nrf_gpio_pin_read().Could the input level to the GPIO4 be read accurately&amp;nbsp; when GPIO4 in the sense mode?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To use it as a regular GPIO you can initialize it as such at the start of your program, and then change to use it as a wakeup pin exclusively right before going to SYSTEM_OFF sleep.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1)I called nrf_gpio_cfg_sense_input() API&amp;nbsp;&lt;/span&gt;&lt;span&gt;exclusively&lt;/span&gt;&lt;span&gt;&amp;nbsp;to&amp;nbsp;initialize&amp;nbsp; the GPIO4&amp;nbsp;at&amp;nbsp;the beginning of the main(),t&lt;/span&gt;he GPIO4 is used as&amp;nbsp;&lt;span&gt;a wakeup source and a USB charging detect pin.&amp;nbsp;&lt;/span&gt;When plug USB to the board, the GPIO4 pin would be high voltage level and the chip could be waked up from SYSTEM_OFF. And the chip can be succeeded to DFU normally when USB keep to plug to the board(when the GPIO4 is 3.3V). The only one problem in this case is that the GPIO4 could not be used for charging detecting, because it could not read the input level to GPIO4 by calling&amp;nbsp;&lt;span&gt;nrf_gpio_pin_read(), the return value of input level&amp;nbsp; from nrf_gpio_pin_read() is always high whether the voltage to GPIO4 is high or low.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2)In the case of to initialize&amp;nbsp;GPIO4 as a regular GPIO at the start of my program and to initialize&amp;nbsp;GPIO4&amp;nbsp;as a wakeup pin exclusively right before going to SYSTEM_OFF sleep, the chip could not start to DFU normally when USB keep to plug to the board(when the GPIO4 is 3.3V), and nRF Connect App always display information of starting bootloader or connecting. But&amp;nbsp;the chip can be succeed to DFU normally when USB was pulled off the board(when the GPIO4 is 0V).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;All in all, I want the GPIO4 can be used as a wakeup source and to read the level of the pin and not to effect the DFU. If the input voltage level to GPIO4 can be read by calling&amp;nbsp;nrf_gpio_pin_read() when GPIO4 is initialized&amp;nbsp;exclusively by&amp;nbsp;nrf_gpio_cfg_sense_input(), I think this issue would be solved.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The GPIO4 could not read the IO level accurately in sense mode.</title><link>https://devzone.nordicsemi.com/thread/375803?ContentTypeID=1</link><pubDate>Wed, 06 Jul 2022 12:54:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bef784b3-fe80-4564-8eaf-b1be7aa49e1b</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Could you confirm whether you are using the nRF Connect SDK or the nRF5 SDK for your application?&lt;br /&gt;Could you also tell me, where do you initialize the GPIO to function as a wakeup source?&lt;br /&gt;To use it as a regular GPIO you can initialize it as such at the start of your program, and then change to use it as a wakeup pin exclusively right before going to SYSTEM_OFF sleep.&lt;br /&gt;How is this done in your program currently?&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></channel></rss>