<?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>Button on the custom board</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108639/button-on-the-custom-board</link><description>Good Day! 
 I am trying to adapt the example from lesson number 4 (Data exchange in BLE, exercise 2) for use on my custom board. 
 The example uses the library &amp;quot;dk_buttons_and_leds&amp;quot;. At the moment I don&amp;#39;t understand how the program determines which button</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 Feb 2024 08:25:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108639/button-on-the-custom-board" /><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/471201?ContentTypeID=1</link><pubDate>Wed, 28 Feb 2024 08:25:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c95000f5-520a-496a-a0d3-de260e2e52bb</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you right click on DK_BTN1_MSK and choose Go To Definition, you will see this in dk_buttons_and_leds.h :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1709108472428v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;It simply check the bit (0 to 3) to detect which the button (1 to 4) is changed.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The GPIO pins themselves&amp;nbsp;are configured as input pins inside the&amp;nbsp;dk_buttons_init() function in dk_buttons_and_leds.c.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/471117?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2024 17:31:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1209504d-67c4-4c4e-b3b2-3b96c452e7fa</guid><dc:creator>backstreet.devisor</dc:creator><description>&lt;p&gt;Sorry for a stupid question, but how do I see which pin corresponds to DK_BTN1_MSK?&lt;br /&gt;When I put the cursor over DK_BTN1_MSK I see BIT(DK_BTN1).&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/DK_5F00_BTN1_5F00_MSK.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/471081?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2024 14:51:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33b68f15-6b29-432f-b0ef-2cdcd2a91400</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Something wrong with your dts file.&amp;nbsp;&lt;br /&gt;So if you use my board file,&amp;nbsp;and&amp;nbsp;keep&amp;nbsp;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;USER_BUTTON&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;DK_BTN1_MSK&amp;nbsp; (don&amp;#39;t modify anything)&lt;br /&gt;Do you see that pin P0.30 is sampled not P0.11&amp;nbsp; ?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/471062?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2024 14:30:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fa92d88-c572-42dd-8057-de2007c8aa1e</guid><dc:creator>backstreet.devisor</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;I tested your .dts sample. &lt;br /&gt;If I write #define USER_BUTTON DK_BTN2_MSK and change it to Button1 in the .dts file, the button state is not read.&lt;/p&gt;
&lt;p&gt;Only #define USER_BUTTON DK_BTN1_MSK works, and it doesn&amp;#39;t matter what number I assign to the button in the .dts file. &lt;br /&gt;:(&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/470976?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2024 10:24:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:152449ad-bb8b-461f-9de3-1bc57f183400</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;br /&gt;Did you use my board files in boards.zip ?&amp;nbsp;&lt;br /&gt;I used that and change&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;USER_BUTTON&lt;/span&gt;&lt;span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;DK_BTN2_MSK&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Then I can see that the button to be detected is now button 2 (GPIO pin P0.12) instead of P0.30 as in&amp;nbsp;DK_BTN1_MSK&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Please try testing with the board files I provided and the peripheral_lbs.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/470820?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 16:24:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1f676ea-e457-4289-9746-857ee5777d3c</guid><dc:creator>backstreet.devisor</dc:creator><description>&lt;p&gt;I only have one button on the board. There are no other buttons.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/470815?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 16:13:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54e2a7ac-d1be-4100-82eb-e7a6a974b681</guid><dc:creator>backstreet.devisor</dc:creator><description>&lt;p&gt;Initially I thought so too, that&lt;br /&gt;DK_BTN1_MSK corresponds to button 0 on my board. But it doesn&amp;#39;t matter what number I assign to button 0, 1, 2 or 3 in the .dts file. The data of the button specified in the .dts is still transmitted via bluetooth, although this should not happen if the button number is different from 0 when DK_BTN1_MSK is specified&lt;/p&gt;
&lt;p&gt;So I&amp;#39;m trying to figure out why this is happening, but I can&amp;#39;t do it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/470795?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 15:01:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a59cf79c-517b-458a-9229-d8e905f16289</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi again,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please explain why you want to configure button3 instead of button 0 ?&lt;br /&gt;If you use&amp;nbsp;DK_BTN1_MSK then you should modify button0 instead of button 3.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to use button 3 you should use&amp;nbsp;DK_BTN4_MSK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/470788?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 14:42:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f88159f-6a80-4297-8686-c6aeb7f20d0e</guid><dc:creator>backstreet.devisor</dc:creator><description>&lt;p&gt;My .dts file is actually in use. &lt;br /&gt;I don&amp;#39;t understand how the program matches the #define string&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define USER_BUTTON DK_BTN1_MSK&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;with button number 3.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;buttons {
		compatible = &amp;quot;gpio-keys&amp;quot;;
		button3: button_3 {
			gpios = &amp;lt;&amp;amp;gpio0 30 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)&amp;gt;;
			label = &amp;quot;Button 3&amp;quot;;
		};
	};
	
	/* These aliases are provided for compatibility with samples */
	aliases {
		
		button3 = &amp;amp;button3;
	};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Changing the button number in the .dts file doesn&amp;#39;t change anything. No matter what button number I write, I still get the value from pin 30, although DK_BTN1_MSK is written in #define.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/470782?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 14:28:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b84d719-1ea8-4c21-a380-3f436563799e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Then you may want to check if the dts file has been actually used.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;One trick I usually do is to try make an error in the file and compile to see if I get build error or not.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I did a quick test here and the attached board worked for me, I changed button 0 to pin 30 and can see that now the input on Pin 30 is sent to the phone in the peripheral_lbs sample.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4186.boards.zip"&gt;devzone.nordicsemi.com/.../4186.boards.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/470741?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 13:08:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d7f7a6a-8ea2-4e1e-bad5-80c7d9460513</guid><dc:creator>backstreet.devisor</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;I created my own custom_board_nrf52840.dts file and made changes in it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Button on the custom board</title><link>https://devzone.nordicsemi.com/thread/470739?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 13:03:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4188c126-afc2-4116-8b42-331791510839</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you let us know which exact file did you modify the device tree to change the button ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Or did you create an overlay file ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Did you&amp;nbsp;use the DK&amp;nbsp;board to build your application&amp;nbsp;or define your own board ?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>