<?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>Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43774/simple-gpio-example---nrf9160-dk</link><description>Hello, 
 I&amp;#39;m having difficulty getting the GPIO set up in a way that behaves predictably on the nRF9160 DK. As far as I understand it, the nRF52840 is what controls the GPIO on the board, and the nRF9160 has to send its requests through it to interact</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 29 Dec 2021 04:28:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43774/simple-gpio-example---nrf9160-dk" /><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/345306?ContentTypeID=1</link><pubDate>Wed, 29 Dec 2021 04:28:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db1bddb9-a3a4-4da3-abc1-f973833e1ae8</guid><dc:creator>Captain CK</dc:creator><description>&lt;p&gt;Try on this program, But I am using SEGGER SDK 1.7.1. Hear I have blinked P0.02 &amp;amp; P0.12. I hope this will help.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;device.h&amp;gt;
#include &amp;lt;devicetree.h&amp;gt;
#include &amp;lt;drivers/gpio.h&amp;gt;

//sleep time
#define SLEEP_TIME_MS   100

void main(void)
{
	int cnt = 0;
	const struct device *dev;

	dev = device_get_binding(&amp;quot;GPIO_0&amp;quot;);
	/* Set led0 pin as output */


	gpio_pin_configure(dev, 2, GPIO_OUTPUT); //GPIO p0.03 == LED2
    gpio_pin_configure(dev,12, GPIO_OUTPUT); //GPIO P0.12

	while (1) {
		/* Set pin to HIGH/LOW every 1 second */
		gpio_pin_set(dev, 2,cnt % 2);	//GPIO p0.03 == LED2
        gpio_pin_set(dev, 12, cnt % 2);

		cnt++;
		k_msleep(SLEEP_TIME_MS);
	}
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/345304?ContentTypeID=1</link><pubDate>Wed, 29 Dec 2021 03:57:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:974da729-2ef2-4350-b1a3-3892345e5287</guid><dc:creator>Captain CK</dc:creator><description>&lt;p&gt;can you please explain what mean by this &amp;quot;cnt&amp;quot; object that was created the beginning of the program.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/181911?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2019 19:40:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b2a2a10-282a-4709-861e-bb6328f1563d</guid><dc:creator>mrwesleycrusher</dc:creator><description>&lt;p&gt;I have discovered that you can get this stuff to work by reading the datasheet for the SiP to get register addresses and then by using the zephyr build tool, west, to compile your programs without using the additional nordic sdk&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/178153?ContentTypeID=1</link><pubDate>Mon, 25 Mar 2019 14:41:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9778850b-adce-4791-9400-d71f117534bd</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Nothing special, other than allocating the io pins correctly. If using the nRF52 SDK then add a suitable .h pinout file to &lt;em&gt;.\Components\Boards\&lt;/em&gt;. This can be created from a file in the nRF9160 tree here &lt;em&gt;.\ncs\Zephyr\boards\arm\nrf52840_pca10090\board.c&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/177693?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2019 23:18:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43f3b5c9-4391-4eb8-a468-1bbfa16e914b</guid><dc:creator>mrwesleycrusher</dc:creator><description>&lt;p&gt;For working with the 52840 on the 9160 DK, can code be compiled for it just like on the older 52840 development kits? Is there anything special I need to do to program for it besides switch the PROG/DEBUG fromnrf91 to nrf52?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Wes&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/173322?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 20:28:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18d71e07-1919-4ad9-95d6-b777dece8651</guid><dc:creator>JustWalt</dc:creator><description>&lt;p&gt;Thanks for your help. I haven&amp;#39;t quite solved the problem yet, but your posts have definitely pointed me in the right direction. Much appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/173311?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 17:49:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6465dded-2002-4436-ab60-0cc63f5eecb4</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;No, D7 is a signal label not a pin as such; P0.07 is the pin, which can be connected to D7 or disconnected from D7 by nRF52_P0.26&amp;nbsp; (I wrote P0.7 above, meaning P0.07 on the nRF9160)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/173309?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 17:46:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b1d50ad-810a-4dcd-a648-3e5c55abdc68</guid><dc:creator>JustWalt</dc:creator><description>&lt;p&gt;Thanks, I&amp;#39;ll give this a shot.&lt;/p&gt;
&lt;p&gt;By D7, I assume you&amp;#39;re talking about the physical P0.07 pin on the board itself?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/173307?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 17:38:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30419bf8-34e1-4035-b5fa-2c48e65ec319</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;I would suggest those pins are indeed available, but they have to be properly directed by the nRF52 to be i/o ports disconnected to buttons and LEDs by setting the appropriate nRF52 pin high to select the required i/o function.&lt;/p&gt;
&lt;p&gt;For example, P0.7 (nRF9160) can be connected to D7 by driving nRF52_P0.26 high (see U12 FSA2466UMX DPDT FET switch)&lt;br /&gt;D7 is available on P13 and P12, two headers which are marked not assembled but pads are available, and are not otherwise connected as far as I can see. These pins may be listed in the user Manual (I haven&amp;#39;t checked), but are traceable on the schematic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/173305?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 17:10:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:794b370a-2de4-4814-84fb-2b1ff2caa883</guid><dc:creator>JustWalt</dc:creator><description>&lt;p&gt;P0.17 was functional. But I need to use pins 2-7.&lt;/p&gt;
&lt;p&gt;&amp;quot;The pins that are available from the nRF91 are pins P0.10 - P0.20 and P0.0 and P0.01.&amp;quot;&lt;/p&gt;
&lt;p&gt;Well, shoot. Where is this made known? Is there a way that I can use the 9160 to communicate with the 52840 to access these pins? They are pretty important for the task I purchased the board for.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Justin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/173275?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 14:16:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae74cf75-b418-4091-9c48-6b17b99124ad</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You didn&amp;#39;t see any activity on P0.17 after programming the hex file? The pins that are available from the nRF91 are pins P0.10 - P0.20 and P0.0 and P0.01.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/172567?ContentTypeID=1</link><pubDate>Fri, 22 Feb 2019 19:15:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b85dc8f-c76b-461f-a6dd-e1df9d4a2e20</guid><dc:creator>JustWalt</dc:creator><description>&lt;p&gt;Sorry Jared, I should have been more specific. The included hex file does run, and I&amp;#39;m able to see the output on the board.&lt;/p&gt;
&lt;p&gt;However, the pins that I need to use are the physical pins on the board. While the LEDs do light up when I set 3 and 4 to high, the actual pin itself sees no change in voltage.&lt;/p&gt;
&lt;p&gt;I need to use pins [P0.0]2, 4, 6, and 7 in order to interact with an Arduino shield. The documentation says that there is an Arduino interface, but nothing about how to activate it. Is that an nRF52840 only feature, or is it available for the nRF9160?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Justin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/172526?ContentTypeID=1</link><pubDate>Fri, 22 Feb 2019 13:51:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe3d1bb3-5def-4ba5-8a07-9cbec8eb7689</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That should be correct. I&amp;#39;ve included a hex that toggles some LEDs and P0.17. Could you flash the hex to the board and see if it run?&lt;/p&gt;
&lt;p&gt;If it doesn&amp;#39;t, then you are maybe missing secureboot?&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;device.h&amp;gt;
#include &amp;lt;gpio.h&amp;gt;

/* 1000 msec = 1 sec */
#define SLEEP_TIME 	1000

void main(void)
{
	int cnt = 0;
	struct device *dev;

	dev = device_get_binding(&amp;quot;GPIO_0&amp;quot;);
	/* Set LED pin as output */
	gpio_pin_configure(dev, 3, GPIO_DIR_OUT); //p0.03 == LED2
	gpio_pin_configure(dev, 4, GPIO_DIR_OUT); //p0.04 == LED3
	gpio_pin_configure(dev, 17, GPIO_DIR_OUT); //p0.17

	while (1) {
		/* Set pin to HIGH/LOW every 1 second */
		gpio_pin_write(dev, 3, cnt % 2);	//p0.03 == LED2
		gpio_pin_write(dev, 4, cnt % 2);	//p0.04 == LED3
		gpio_pin_write(dev, 17, cnt % 2);	//p0.17 Toggling pin 17
		cnt++;
		k_sleep(SLEEP_TIME);
	}
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Togglepin.hex"&gt;devzone.nordicsemi.com/.../Togglepin.hex&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/172181?ContentTypeID=1</link><pubDate>Wed, 20 Feb 2019 19:48:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a58b72b-04df-49b9-ab6f-8cc543b36369</guid><dc:creator>JustWalt</dc:creator><description>&lt;p&gt;Hi Jared,&lt;/p&gt;
&lt;p&gt;Thanks for the response.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure how to set those pins. Should I address them as such: &lt;span style="font-family:courier new, courier;"&gt;gpio_pin_write(gpio_dev, 17, 1);&lt;/span&gt;?&lt;/p&gt;
&lt;p&gt;Perhaps I&amp;#39;m doing something else wrong, because this has no effect. Is there some .overlay or prj.conf setting that I&amp;#39;ll need to have active so I can access the GPIO from nRF9160 code?&lt;/p&gt;
&lt;p&gt;Justin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple GPIO Example - nRF9160 DK</title><link>https://devzone.nordicsemi.com/thread/172068?ContentTypeID=1</link><pubDate>Wed, 20 Feb 2019 10:18:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aaaba913-0887-4d33-b944-2aec031127cd</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.nordicsemi.com/DocLib/Content/User_Guides/nrf91_dk/latest/UG/nrf91_DK/hw_description/board_controller"&gt;P0.02 is connected to LED 1 (&lt;/a&gt;Note that there is an error in the pin mapping in that it should state that LED 2 should be connected P0.03 etc..) . You can try P0.17, P0.18, or P0.19 instead.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>