<?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>Read value on EXT pin thingy 52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60995/read-value-on-ext-pin-thingy-52</link><description>Hello. 
 I having problems with reading a value from one of the ext pins on thingy 52. (i can set the pin as output and toggle the pin from code.) 
 i have configured the pin as input. 
 
 
 I want to do something when the pin goes low, iam trying to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 May 2020 15:24:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60995/read-value-on-ext-pin-thingy-52" /><item><title>RE: Read value on EXT pin thingy 52</title><link>https://devzone.nordicsemi.com/thread/247967?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 15:24:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2509240b-8958-4037-b4c6-c7d8f486a888</guid><dc:creator>Guojun Wang</dc:creator><description>&lt;p&gt;You are welcome!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read value on EXT pin thingy 52</title><link>https://devzone.nordicsemi.com/thread/247964?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 15:20:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25d2870e-dc45-45a5-a413-c1e5d51b373d</guid><dc:creator>Rilleaa</dc:creator><description>&lt;p&gt;Okey thank you very much for the help guwa!&lt;/p&gt;
&lt;p&gt;//Rilleaa&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read value on EXT pin thingy 52</title><link>https://devzone.nordicsemi.com/thread/247956?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 15:05:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:088fb2db-9c76-447e-9ce5-84a4397c3120</guid><dc:creator>Guojun Wang</dc:creator><description>&lt;p&gt;I think it is better to enable pin level interrupt with GPIOTE and make use of interrupt handler to sample the ADC.&lt;/p&gt;
&lt;p&gt;In this case, the application doesn&amp;#39;t have to actively reading pin levels all the time, and the CPU can go to sleep and only wakes up on interrupt.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read value on EXT pin thingy 52</title><link>https://devzone.nordicsemi.com/thread/247946?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 14:53:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41581270-53a8-4422-bbba-47c9a627285f</guid><dc:creator>Rilleaa</dc:creator><description>&lt;p&gt;Thank you!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yes i must have&amp;nbsp;misunderstood the function and when i did as you recomended the while loop work as i intended.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can i ask you another question?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;At the moment i use the function as follows in the code bellow. What i want to do is get data from an adc when new data is ready witch is indicated by pulling the pin low. Would the code bellow be a good way of using the function&amp;nbsp;&lt;span&gt;drv_ext_gpio_pin_read() to wait for that indication that new data is ready or could it be used in a more effict way?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    uint32_t pinvalue;

    while(pinvalue != 0 ){

        //do nothing
    
        drv_ext_gpio_pin_read(SX_IOEXT_1, &amp;amp;pinvalue);

        
    }
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;//Rilleaa&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read value on EXT pin thingy 52</title><link>https://devzone.nordicsemi.com/thread/247915?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 14:08:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f86cbf27-d0f4-4694-8d5f-ab8adbde6c74</guid><dc:creator>Guojun Wang</dc:creator><description>&lt;p&gt;Hi Rilleaa,&lt;/p&gt;
&lt;p&gt;I think you may have misunderstood the usage of this function&amp;nbsp;drv_ext_gpio_pin_read(&lt;span class="pl-c1"&gt;uint32_t&lt;/span&gt;&lt;span&gt; pin_number, &lt;/span&gt;&lt;span class="pl-c1"&gt;uint32_t&lt;/span&gt;&lt;span&gt; * &lt;/span&gt;&lt;span class="pl-k"&gt;const&lt;/span&gt;&lt;span&gt; p_pin&lt;/span&gt;). The second argument is passed in to store the pin levels.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If pin level is read successfully,&amp;nbsp;&lt;span&gt;drv_ext_gpio_pin_read will return&amp;nbsp;DRV_EXT_GPIO_STATUS_CODE_SUCCESS (0x00), otherwise it will return values other than 0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Once this function returns SUCCESS, then you check the pin level stored in pointer p_pin.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In case it still does not work, you can debug it by setting input pin with PULL UP and read the level again. It should be 1 in this case.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hope this will help you!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>