<?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>BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42917/bsp-button-events-not-getting-triggered</link><description>Hi using dev kit pca10040 and sdk 14.2. 
 I&amp;#39;m trying to use the dev kit buttons to stub out an ANT+ bike speed sensor. Essentially I just need a way to provide a speed reading into the system that I can deterministically vary. Softdevice S332 is resident</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 30 Jan 2019 22:25:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42917/bsp-button-events-not-getting-triggered" /><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/168773?ContentTypeID=1</link><pubDate>Wed, 30 Jan 2019 22:25:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c542f653-dc91-47cb-b16c-8e68925785d8</guid><dc:creator>Ron</dc:creator><description>&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;Oops! &lt;/span&gt;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f633.svg" title="Flushed"&gt;&amp;#x1f633;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;That&amp;#39;s the ticket. Working like a charm now. Thanks Einar!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/168603?ContentTypeID=1</link><pubDate>Wed, 30 Jan 2019 06:59:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0626d42-1c5e-46c7-ba03-f157874e6443</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Ron,&lt;/p&gt;
&lt;p&gt;The code you have added requests the HF clock, but that is not what is missing. The app timer use an RTC, which needs the 32 kHz LF clock, so you should request it by using nrf_drv_clock_lfclk_request() instead.&lt;/p&gt;
&lt;p&gt;Regarding the GPIOTE driver that is not a problem. It is fine that you initialize it yourself, but if you had not it would have been initialized by app_button_init() which is called from bsp_init().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/168588?ContentTypeID=1</link><pubDate>Wed, 30 Jan 2019 03:00:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:197b2cf7-f054-45ef-8c4c-0e8235725715</guid><dc:creator>Ron</dc:creator><description>&lt;p&gt;Thanks Einar,&lt;/p&gt;
&lt;p&gt;Still no joy&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f616.svg" title="Confounded"&gt;&amp;#x1f616;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I added this to the top of main():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	if (nrf_drv_clock_init() != NRF_SUCCESS)
	{
		return NRF_ERROR_INTERNAL;
	}

	nrf_drv_clock_hfclk_request(NULL);
	while (!nrf_drv_clock_hfclk_is_running())
	{
	}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is what&amp;#39;s in sdk_config.h for the clock:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//==========================================================
// &amp;lt;e&amp;gt; CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver
//==========================================================
#ifndef CLOCK_ENABLED
#define CLOCK_ENABLED 1
#endif
// &amp;lt;o&amp;gt; CLOCK_CONFIG_XTAL_FREQ  - HF XTAL Frequency
 
// &amp;lt;0=&amp;gt; Default (64 MHz) 

#ifndef CLOCK_CONFIG_XTAL_FREQ
#define CLOCK_CONFIG_XTAL_FREQ 0
#endif

// &amp;lt;o&amp;gt; CLOCK_CONFIG_LF_SRC  - LF Clock Source
 
// &amp;lt;0=&amp;gt; RC 
// &amp;lt;1=&amp;gt; XTAL 
// &amp;lt;2=&amp;gt; Synth 

#ifndef CLOCK_CONFIG_LF_SRC
#define CLOCK_CONFIG_LF_SRC 1
#endif

// &amp;lt;o&amp;gt; CLOCK_CONFIG_IRQ_PRIORITY  - Interrupt priority
 

// &amp;lt;i&amp;gt; Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
// &amp;lt;0=&amp;gt; 0 (highest) 
// &amp;lt;1=&amp;gt; 1 
// &amp;lt;2=&amp;gt; 2 
// &amp;lt;3=&amp;gt; 3 
// &amp;lt;4=&amp;gt; 4 
// &amp;lt;5=&amp;gt; 5 
// &amp;lt;6=&amp;gt; 6 
// &amp;lt;7=&amp;gt; 7 

#ifndef CLOCK_CONFIG_IRQ_PRIORITY
#define CLOCK_CONFIG_IRQ_PRIORITY 7
#endif

// &amp;lt;/e&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I noticed the doc for bsp_init() says the &lt;em&gt;app_gpiote&lt;/em&gt; module is required, but the 14.2 SDK doc suggests this is deprecated in favour of &lt;em&gt;nrf_drv_gpiote&lt;/em&gt;, which I am actively using, so I assume this is a non-issue? Not sure what else to look at.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/168400?ContentTypeID=1</link><pubDate>Tue, 29 Jan 2019 09:22:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e54d996-c2ad-409c-9b5c-901ee612bfb4</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Ron,&lt;/p&gt;
&lt;p&gt;The project needed some adjustment in order to build it (could not just be dropped in to the SDK 14.2 distribution). Therefore, I have not tested your code, but I think I spotted the problem. When not using&amp;nbsp;BSP_SIMPLE, the BSP library uses app timers to handle buttons. However, the app_timer will not work if the 32 kHz clock is not started, and in that case, you will not get any button events.&lt;/p&gt;
&lt;p&gt;You do not need to start the 32 kHz clock explicitly if you use a SoftDevice, as it will start it when the SoftDevice is enabled. However, I do not see that you enable a&amp;nbsp;SoftDevice in your application, and then you have to start the 32 kHz clock explicitly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/168318?ContentTypeID=1</link><pubDate>Mon, 28 Jan 2019 18:01:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:373b788f-2398-417d-9ba0-ffa3fd6ee6de</guid><dc:creator>Ron</dc:creator><description>&lt;p&gt;Here you go...&lt;a title="GPIOPower.zip" href="https://drive.google.com/open?id=1Plpc9LDWv4c3-_Iwsqxzgo65C5abe5O6"&gt;Google Drive&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/168292?ContentTypeID=1</link><pubDate>Mon, 28 Jan 2019 15:05:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2926b16e-197e-4332-87d7-512c697ad419</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;It should work... Can you upload the complete test project (including project files etc.) so that I can test on a DK on my side?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/168216?ContentTypeID=1</link><pubDate>Mon, 28 Jan 2019 12:46:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11683703-b800-4c8c-8aff-7cfbecf81149</guid><dc:creator>Ron</dc:creator><description>&lt;p&gt;Got it. So any suggestions? Still not seeing the button press events fire&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f615.svg" title="Confused"&gt;&amp;#x1f615;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/168181?ContentTypeID=1</link><pubDate>Mon, 28 Jan 2019 10:09:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d07b0f16-25de-416f-9961-3af9671f1c02</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will ignore the UART comment &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Yes, you cannot use&amp;nbsp;BSP_DEFINES_ONLY if you want full BSP functionality.&amp;nbsp;The&amp;nbsp;&lt;span&gt;GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS has to be as high as the number of pins you want to use. That is because it is used to set the size of an array containing function pointers to event handlers, and for iterating&amp;nbsp;over all pins in the interrupt handler for low power port events etc.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/167745?ContentTypeID=1</link><pubDate>Thu, 24 Jan 2019 17:32:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6a8f68c-2a58-49c1-a53e-836337aea6d1</guid><dc:creator>Ron</dc:creator><description>&lt;p&gt;Ignore the comment about the UART.&amp;nbsp; That is resolved and was unrelated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/167730?ContentTypeID=1</link><pubDate>Thu, 24 Jan 2019 16:35:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d65bafe-2dbc-4f12-b0c5-6a38aa852cd0</guid><dc:creator>Ron</dc:creator><description>&lt;p&gt;Thanks Einar!&amp;nbsp; I found removing BSP_SIMPLE was generating some unresolved symbols until I also undefined BSP_DEFINES_ONLY.&amp;nbsp; I found I also had to increase&amp;nbsp;GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS. I increased to 4, as it seemed to want one for each button?&lt;/p&gt;
&lt;p&gt;So now the app compiles and runs again, but my breakpoint in the button event handler is still not being hit.&amp;nbsp; Also, it seems as though the changes may have disabled logging over UART? In case it&amp;#39;s material, these are the defines that are left (inherited from the original example):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;c_preprocessor_definitions=&amp;quot;BOARD_PCA10040;CONFIG_GPIO_AS_PINRESET;FLOAT_ABI_HARD;INITIALIZE_USER_SECTIONS;NO_VTOR_CONFIG;NRF52;NRF52832_XXAA;NRF52_PAN_74;&amp;quot;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BSP Button events not getting triggered</title><link>https://devzone.nordicsemi.com/thread/167658?ContentTypeID=1</link><pubDate>Thu, 24 Jan 2019 13:49:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af946673-c0dc-404d-9dce-1ebd2f55cf91</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You will not get button interrupts if&amp;nbsp;BSP_SIMPLE. So if you want to use the BSP with button events, you have to remove the&amp;nbsp;BSP_SIMPLE define.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>