<?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>nrf51822EK on kit button triggering</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9116/nrf51822ek-on-kit-button-triggering</link><description>I have burnt ble-app-multilink peripheral code on my nrf51822ek. What happens currently is dat when i press button on kit, on kit led turns on . when i press it again, it turns off. 
 I require that when button is in pressed state it, the led should</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Sep 2015 20:15:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9116/nrf51822ek-on-kit-button-triggering" /><item><title>RE: nrf51822EK on kit button triggering</title><link>https://devzone.nordicsemi.com/thread/33576?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2015 20:15:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68f50102-a7ce-4026-abae-e8456ee57b3e</guid><dc:creator>Hamza</dc:creator><description>&lt;p&gt;YOu deserve noble prize for this Stefan. I had the same problem ,
and now it is solved.
Thankyou so much.... :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822EK on kit button triggering</title><link>https://devzone.nordicsemi.com/thread/33575?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2015 16:34:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:adbf0c66-3d73-4e4b-b748-9aee27c7af6f</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Mohib&lt;/p&gt;
&lt;p&gt;Since you are using the evaluation kit, my guess is that you are using &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v6.x.x/"&gt;SDK 6.1.0&lt;/a&gt; or older, since that is still &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.pdf.sds/nRF51_Series_Compatibility_Matrix_v2.4.pdf"&gt;compatible with&lt;/a&gt; the nRF51 revision 2, which resides on the evaluation kit.&lt;/p&gt;
&lt;p&gt;For &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v6.x.x/doc/6.1.0/index.html"&gt;SDK 6.1.0&lt;/a&gt;, you can take a look at e.g. the &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v6.x.x/doc/6.1.0/s110/html/a00035.html"&gt;pin_change_int_example&lt;/a&gt;, which I think does exactly what you are asking for. It uses GPIOTE directly. However, the example does not implement any de-bounce function, so when pressing the button on the ev-kit, you will occasionally not see the led turn on, because the signal possibly bounces and the led is both turned on and off by a single button press.&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v6.x.x/doc/6.1.0/s110/html/a00012.html"&gt;app_button library&lt;/a&gt; does however implement a de-bounce function. The debounce function of app_button is very simple&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When a button is pressed, a timer is started&lt;/li&gt;
&lt;li&gt;when the timer expires, button state is read and an event to the application is given with the state of the button&lt;/li&gt;
&lt;li&gt;same is done when a button is released as when button is pressed&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see an example how app_button library is used by looking at the &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v6.x.x/doc/6.1.0/s110/html/a00060.html"&gt;ble_app_bsp example&lt;/a&gt; which is set up with softdevice. The steps required to include a button function is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;include the app_button library in your project&lt;/li&gt;
&lt;li&gt;The app_button library uses both app_timer and app_gpiote libraries, so you need to initialize those before initializing app_button library in a similar way as done in the ble_app_bps example with call to the APP_TIMER_INIT and APP_GPIOTE_INIT macros&lt;/li&gt;
&lt;li&gt;Create app_button array, as done in button_init() function in the ble_app_bps example&lt;/li&gt;
&lt;li&gt;Create button handler, as done with button_event_handler in the ble_app_bps example. The app_button_handler will fire both when you press the button and release the button. Read what button state triggered the handler by reading button_action&lt;/li&gt;
&lt;li&gt;Initialize the button library with call to APP_BUTTON_INIT macro. There you define with BUTTON_DETECTION_DELAY how long time should elapse from the button press until reading the button state and give event to the application&lt;/li&gt;
&lt;li&gt;Enable buttons with call to app_button_enable(), which is done in ble_app_bps when BLE connection has been established, but you could also do it right away after calling APP_BUTTON_INIT&lt;/li&gt;
&lt;li&gt;You may need to increase the APP_TIMER_MAX_TIMERS constant since the button library uses one app_timer per button.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more advanced de-bounce function than app_button implements, you can look at the &lt;a href="http://developer.nordicsemi.com/nRF51_SDK/nRF51_SDK_v6.x.x/doc/6.1.0/s110/html/a00027.html"&gt;debouncer_example in nRF51 SDK 6.1.0&lt;/a&gt;. It implements so-called integrator debouncer. The method is fairly simple and its basics are explained on &lt;a href="http://www.kennethkuhn.com/electronics/debounce.c"&gt;this link&lt;/a&gt; and the method is best explained with the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;real signal 0000111111110000000111111100000000011111111110000000000111111100000
corrupted   0100111011011001000011011010001001011100101111000100010111011100010
integrator  0100123233233212100012123232101001012321212333210100010123233321010
output      0000001111111111100000001111100000000111111111110000000001111111000
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822EK on kit button triggering</title><link>https://devzone.nordicsemi.com/thread/33570?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2015 12:17:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b507675b-09ec-4d06-986a-6b1d4560bcf9</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Mohib&lt;/p&gt;
&lt;p&gt;Can you report what SDK version you are using and what softdevice and what version you are working with. Also, what version of the evaluation kit you have.  How is your setup, do you have two evaluation boards, one multilink central and one for multilink peripheral?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822EK on kit button triggering</title><link>https://devzone.nordicsemi.com/thread/33574?ContentTypeID=1</link><pubDate>Wed, 16 Sep 2015 14:50:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3965e0c9-85bc-4d2e-ba73-016888dc4d18</guid><dc:creator>Mohib</dc:creator><description>&lt;p&gt;I couldnot find any function like bsp_event_handler .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822EK on kit button triggering</title><link>https://devzone.nordicsemi.com/thread/33573?ContentTypeID=1</link><pubDate>Thu, 10 Sep 2015 12:41:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:306592fd-460d-405c-b4b9-8976ee267f0d</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;You can look into the GPIOTE functionality and &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk52.v0.9.1/group__nrf__gpiote__abs.html?resultof=%22%67%70%69%6f%74%65%22%20%22%67%70%69%6f%74%22%20"&gt;drivers&lt;/a&gt;. I don&amp;#39;t think we have any good examples for GPIOTE right now. There is just &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk51.v9.0.0/nrf_gpiote_example.html?resultof=%22%67%70%69%6f%74%65%22%20%22%67%70%69%6f%74%22%20"&gt;this&lt;/a&gt;. I can only advice you to read the GPIOTE chapter in the Reference Manual and the driver documentation. What you want to do is to make an interrupt that triggers on both high-to-low and low-to-high events on a pin. Then look at the code in the &lt;em&gt;bsp_event_handler()&lt;/em&gt; function in the multilink peripheral and implement it in your GPIOTE interrupt handler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822EK on kit button triggering</title><link>https://devzone.nordicsemi.com/thread/33572?ContentTypeID=1</link><pubDate>Wed, 09 Sep 2015 15:42:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:898b9c9b-908f-436c-967c-02b2140eb6e8</guid><dc:creator>Mohib</dc:creator><description>&lt;p&gt;What this routine should be like ? and where should it be coded ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822EK on kit button triggering</title><link>https://devzone.nordicsemi.com/thread/33571?ContentTypeID=1</link><pubDate>Wed, 09 Sep 2015 08:59:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9462bbf5-62d0-4f3a-987c-833c3f165264</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;It looks like the Board Support Package (bsp) used in the example to handle the button events only supports button presses &lt;em&gt;or&lt;/em&gt; button releases. In the example the button event handler is configured to trigger only on button pushes. So to make your peripheral to act like want you will need to write your own gpiote interrupt routine that triggers on both events.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>