<?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>How to get pulse time with microsecond level?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90150/how-to-get-pulse-time-with-microsecond-level</link><description>Hi Nordic, 
 I need to read pulse time which is microsecond level in different channel, I have consider combining timers with GPIOE but the timer is millisecond level. Is there any example to achieve it? 
 BTW, I&amp;#39;m using SDK17.02 on nRF52810.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Jul 2022 10:12:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90150/how-to-get-pulse-time-with-microsecond-level" /><item><title>RE: How to get pulse time with microsecond level?</title><link>https://devzone.nordicsemi.com/thread/377815?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 10:12:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41e47861-7b96-4638-a301-ab93b300e015</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;The app timer tick frequency depends on the config you set in sdk_config.h (APP_TIMER_CONFIG_RTC_FREQUENCY). If you set it to 0 you get the max tick rate of 32768 ticks per seconds which equals about 30.5us per tick.&lt;/p&gt;
&lt;p&gt;You cannot use any ticks less than 5 in&amp;nbsp;app_timer_start, so the shortest delay you can get is around 152.5us. Getting smaller than that using app_timer is not possible. You should try to use high frequency TIMERS instead for that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get pulse time with microsecond level?</title><link>https://devzone.nordicsemi.com/thread/377811?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 09:55:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f97a95b1-c2a7-4d1e-ab70-39ad6a0e2ffa</guid><dc:creator>qwertynoon</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static const nrfx_timer_t micros_sample_timer = NRFX_TIMER_INSTANCE(4); //select timer instance

uint32_t micros;

static void micros_timer_handler(nrf_timer_event_t event_type, void * p_context)
{
    micros++;
}

static int timer_init_micros(void)
{
    nrfx_err_t err;
    nrfx_timer_config_t timer_cfg = {
        .frequency = NRF_TIMER_FREQ_16MHz,
        .mode = NRF_TIMER_MODE_TIMER,
        .bit_width = NRF_TIMER_BIT_WIDTH_32,
    };

    err = nrfx_timer_init(&amp;amp;micros_sample_timer, &amp;amp;timer_cfg, micros_timer_handler);
    if (err != NRFX_SUCCESS) {
        LOG_INF(&amp;quot;nrfx_timer_init failed with: %d\n&amp;quot;, err);
        return -EAGAIN;
    }
/* For Zephyr*/
/*
    IRQ_CONNECT(DEFAULT_TIMER_IRQ, DEFAULT_TIMER_PRIORITY,
            DEFAULT_TIMER_IRQ_HANDLER, NULL, 0);
*/

    nrfx_timer_extended_compare(&amp;amp;micros_sample_timer,
            NRF_TIMER_CC_CHANNEL4,
            nrfx_timer_us_to_ticks(&amp;amp;micros_sample_timer, 1), // 1 us tic
            NRF_TIMER_SHORT_COMPARE4_CLEAR_MASK,
            true);

    nrfx_timer_enable(&amp;amp;micros_sample_timer);

    return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;use micros for pulse period calc&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get pulse time with microsecond level?</title><link>https://devzone.nordicsemi.com/thread/377769?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 07:03:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbfcec1b-c6fa-4e74-83f1-0a32ef7f998d</guid><dc:creator>Taylor</dc:creator><description>&lt;p&gt;I&amp;#39;m using HID demo in SDK17.02.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void timers_init(void)
{
    ret_code_t err_code;

    err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);

    // Create battery timer.
    err_code = app_timer_create(&amp;amp;m_battery_timer_id,
                                APP_TIMER_MODE_REPEATED,
                                battery_level_meas_timeout_handler);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And the APP_TIMER_TICKS(xx) is millisecond level.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get pulse time with microsecond level?</title><link>https://devzone.nordicsemi.com/thread/377581?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2022 10:47:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1743099d-fef3-49c5-929e-a171c70a3f0d</guid><dc:creator>qwertynoon</dc:creator><description>&lt;p&gt;Hi. Share your timer init part of code please.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>