<?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>Demand: nRF52 Timer operate in 400ns. 
nRF52 Timer Interrupt response time is too slow!</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61662/demand-nrf52-timer-operate-in-400ns-nrf52-timer-interrupt-response-time-is-too-slow</link><description>Hello everyone 
 I am using nRF52 DK PCA10040. 
 I try to generate puls by Timer 0. 
 The puls width is 400ns. 
 This goal was failed. 
 ----------------------------------------------------- 
 I find out enter timer0 interrupt until leave. 
 It cost around</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 23 May 2020 03:57:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61662/demand-nrf52-timer-operate-in-400ns-nrf52-timer-interrupt-response-time-is-too-slow" /><item><title>RE: Demand: nRF52 Timer operate in 400ns. 
nRF52 Timer Interrupt response time is too slow!</title><link>https://devzone.nordicsemi.com/thread/251335?ContentTypeID=1</link><pubDate>Sat, 23 May 2020 03:57:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b74910ae-b2f0-4c74-b8f4-50934ec97f2d</guid><dc:creator>Austin (S.F.)</dc:creator><description>&lt;p&gt;Hi Edvin&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Thanks you reply.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; I try to make timer as fast as possible, but it&amp;#39;s failed.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; I toggle the pin to check the interrupt timing cost. I found interrupt timing cost is around 730ns ~ 1us.&lt;/p&gt;
&lt;p&gt;--------------------------------------&lt;/p&gt;
&lt;p&gt;I will try your suggestion, the PPI and GPIOTE.&lt;/p&gt;
&lt;p&gt;Could you tell me how to use PPI to setup a pin to be input mode?&lt;/p&gt;
&lt;p&gt;Austin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Demand: nRF52 Timer operate in 400ns. 
nRF52 Timer Interrupt response time is too slow!</title><link>https://devzone.nordicsemi.com/thread/251282?ContentTypeID=1</link><pubDate>Fri, 22 May 2020 14:05:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03d199df-4ef4-4f3c-b401-63bb43af3481</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t understand. You set up the timer, but you toggle the pin both from your main loop and in your timeout interrupt?&lt;/p&gt;
&lt;p&gt;If the timer is too fast, you should look into the PPI (programmable peripheral interface). Check out the example found in SDK\examples\peripheral\ppi&lt;/p&gt;
&lt;p&gt;This example doesn&amp;#39;t toggle a pin, but writes some information in the log. Monitor the UART log.&lt;/p&gt;
&lt;p&gt;But you can change this example to set the PPI task to toggle the pin. It is a bit complex. You need to use&amp;nbsp;nrf_drv_gpiote_set_task_addr_get instead of&amp;nbsp;nrf_drv_timer_task_address_get in&amp;nbsp;nrf_drv_timer_task_address_get().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Demand: nRF52 Timer operate in 400ns. 
nRF52 Timer Interrupt response time is too slow!</title><link>https://devzone.nordicsemi.com/thread/251120?ContentTypeID=1</link><pubDate>Thu, 21 May 2020 09:45:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b43e8839-821b-49bd-905f-922f807ea8a8</guid><dc:creator>Austin (S.F.)</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;nrf_drv_timer.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;

const nrf_drv_timer_t TIMER_LED = NRF_DRV_TIMER_INSTANCE(0);

#define TEST_OUT1	12

/**
 * @brief Handler for timer events.
 */
void timer_led_event_handler(nrf_timer_event_t event_type, void* p_context)
{
		nrf_gpio_pin_write (TEST_OUT1, 1);
		NRF_TIMER0-&amp;gt;EVENTS_COMPARE[0] = 0;	
}


/**
 * @brief Function for main application entry.
 */
int main(void)
{
    NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;
    while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0);
	
	nrf_gpio_cfg_output (TEST_OUT1);									//SETUP TEST P1 = OUTPUT	
	
  NRF_TIMER0-&amp;gt;TASKS_STOP = 1;	// Stop timer
  NRF_TIMER0-&amp;gt;MODE = TIMER_MODE_MODE_Timer;  // taken from Nordic dev zone
  NRF_TIMER0-&amp;gt;BITMODE = (TIMER_BITMODE_BITMODE_08Bit &amp;lt;&amp;lt; TIMER_BITMODE_BITMODE_Pos);
  NRF_TIMER0-&amp;gt;PRESCALER = 0;	// 1us resolution
  NRF_TIMER0-&amp;gt;TASKS_CLEAR = 1; // Clear timer
  NRF_TIMER0-&amp;gt;CC[0] = 200;					//375ns 
  NRF_TIMER0-&amp;gt;INTENSET = TIMER_INTENSET_COMPARE0_Enabled &amp;lt;&amp;lt; TIMER_INTENSET_COMPARE0_Pos;  // taken from Nordic dev zone
  NRF_TIMER0-&amp;gt;SHORTS = (TIMER_SHORTS_COMPARE0_CLEAR_Enabled &amp;lt;&amp;lt; TIMER_SHORTS_COMPARE0_CLEAR_Pos);
	_NRFX_IRQ_PRIORITY_SET(TIMER0_IRQn,1);
	NVIC_EnableIRQ(TIMER0_IRQn);
  NRF_TIMER0-&amp;gt;TASKS_START = 1;	// Start TIMER

    while (1)
    {
		nrf_gpio_pin_write (TEST_OUT1, 0);
    }
}

/** @} */
&lt;/pre&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void timer_led_event_handler(void);

#if NRFX_CHECK(NRFX_TIMER0_ENABLED)
void nrfx_timer_0_irq_handler(void)
{
	timer_led_event_handler();
//    irq_handler(NRF_TIMER0, &amp;amp;m_cb[NRFX_TIMER0_INST_IDX],
//        NRF_TIMER_CC_CHANNEL_COUNT(0));
}
#endif
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Modify SDK16 example Timer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Demand: nRF52 Timer operate in 400ns. 
nRF52 Timer Interrupt response time is too slow!</title><link>https://devzone.nordicsemi.com/thread/251117?ContentTypeID=1</link><pubDate>Thu, 21 May 2020 09:15:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb20d174-25e0-432d-9805-a5b0076f1990</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/4578._5F00_Insert-Code-_2D00_-Nordic-2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>