<?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>Starting timer disables gpiote button</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35552/starting-timer-disables-gpiote-button</link><description>Hi, 
 I am developing a code in which, among other things, when a button is pressed, a led turns on. In the same button handler, a timer is started to turn the led off a bit later. 
 It works perfectly well in the beginning, but after pushing the button</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Jun 2018 11:30:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35552/starting-timer-disables-gpiote-button" /><item><title>RE: Starting timer disables gpiote button</title><link>https://devzone.nordicsemi.com/thread/137074?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 11:30:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6feae2e5-24e9-4079-8907-64ec7694a3c8</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi 114r5,&lt;/p&gt;
&lt;p&gt;I am glad to hear that you found the issue and solved it.&lt;/p&gt;
&lt;p&gt;You should &lt;strong&gt;not&lt;/strong&gt; change things in &lt;em&gt;&amp;quot;app_timer.c&amp;quot; , &lt;/em&gt; that can cause unwanted behaviour as you saw yourself.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to increase the queue size you do this in the &amp;quot;sdk_config.h&amp;quot; file.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-75f158d538de41a08fe6dd6412b7b08d/pastedimage1529579924947v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Starting timer disables gpiote button</title><link>https://devzone.nordicsemi.com/thread/137052?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 10:25:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:630955e5-ac81-4382-ba6d-90db6d9328d4</guid><dc:creator>114r5</dc:creator><description>&lt;p&gt;Oh, I think I found the problem.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;One day, in app_timer_init(), I changed m_op_queue.size = APP_TIMER_CONFIG_OP_QUEUE_SIZE+&lt;strong&gt;1&lt;/strong&gt; for m_op_queue.size = APP_TIMER_CONFIG_OP_QUEUE_SIZE+&lt;strong&gt;2&lt;/strong&gt;. (sorry for that silly change, don&amp;#39;t ask me why)&lt;/p&gt;
&lt;p&gt;Now I turned back to its original state and seems to work well. How does it affect to the code? Why a change like this may cause that kind of problems?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Starting timer disables gpiote button</title><link>https://devzone.nordicsemi.com/thread/137049?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 10:10:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21948bfa-f180-4394-8700-20c3016af6c5</guid><dc:creator>114r5</dc:creator><description>&lt;p&gt;No luck.&lt;/p&gt;
&lt;p&gt;I tried doing the same action using the bsp functions as it is done in the bsp example and the result&amp;nbsp;is the same. At the third push, the led fades fastly and the button responds no more. No error is fired.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
void bsp_evt_handler(bsp_event_t evt)
{
	uint32_t err_code;
	if(evt == BSP_EVENT_KEY_0)
	{
		actual_state = BSP_INDICATE_BUTTON_PRESSED;
		err_code = bsp_indication_set(actual_state);
		APP_ERROR_CHECK(err_code);
	}
}

void leds_and_buttons_init(void)
{
	uint32_t err_code;
	err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, bsp_evt_handler);
	APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static uint32_t bsp_led_indication(bsp_indication_t indicate)
{
    uint32_t err_code   = NRF_SUCCESS;
    uint32_t next_delay = 0;

    if (m_leds_clear)
    {
        m_leds_clear = false;
        leds_off();
    }

    switch (indicate)
    {
        case BSP_INDICATE_IDLE:
            leds_off();
            m_stable_state = indicate;
            break;
				
		case BSP_INDICATE_INIT:
				bsp_board_led_on(1);
				err_code = app_timer_start(m_leds_timer_id, APP_TIMER_TICKS(3500), NULL);
			break;
			
		case BSP_INDICATE_BUTTON_PRESSED:
				bsp_board_led_on(1);
				bsp_board_led_on(2);
				err_code = app_timer_start(m_leds_timer_id, APP_TIMER_TICKS(1000), NULL);
			break;

		case BSP_INDICATE_ALIVE:
				bsp_board_led_on(2);
				err_code = app_timer_start(m_leds_timer_id, APP_TIMER_TICKS(50), NULL);
			break;
					
        default:
            break;
    }

    return err_code;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Starting timer disables gpiote button</title><link>https://devzone.nordicsemi.com/thread/136930?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 13:58:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3075c3a-13c0-4233-90ad-cf4a68268349</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi 114r5,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; It seems like you have a debouncing issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would recommend you to check out the &amp;quot;&lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.2.0%2Flib_button.html&amp;amp;cp=4_0_1_3_7" target="_blank" rel="noopener noreferrer"&gt;Button handling library&lt;/a&gt;&amp;quot; and especially how this is done in the &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.2.0%2Fbsp_example.html&amp;amp;cp=4_0_1_4_6_4" target="_blank" rel="noopener noreferrer"&gt;BSP example.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>