<?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 make a Pulse with Timer1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/578/how-to-make-a-pulse-with-timer1</link><description>Hi, 
 i need to make pulse with one of my Timers. Timer0 is used by the softdevice, and Timer2 is used to make PWM. I need to make a Pulse wich is 100us long, every 250ms (4hz). If i use Timer0 in my configuration i only can make this Pulse every 50ms</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Oct 2013 13:37:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/578/how-to-make-a-pulse-with-timer1" /><item><title>RE: how to make a Pulse with Timer1</title><link>https://devzone.nordicsemi.com/thread/3006?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2013 13:37:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3a90366-a1db-4d91-8b05-e536be7767e6</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;Please see my edit. I haven&amp;#39;t tested this, but it should at least make it clear how you could do it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to make a Pulse with Timer1</title><link>https://devzone.nordicsemi.com/thread/3005?ContentTypeID=1</link><pubDate>Wed, 02 Oct 2013 12:46:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5739ced-0591-4a30-a699-977923fe6ebc</guid><dc:creator>Nils Minor</dc:creator><description>&lt;p&gt;Hi thank you Ole, This i a good example. I Understand what happens in this code. But how is it when i want to call a Method every CC[0] or CC[1] happens?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to make a Pulse with Timer1</title><link>https://devzone.nordicsemi.com/thread/3004?ContentTypeID=1</link><pubDate>Wed, 02 Oct 2013 12:28:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30fac517-5056-49da-8607-12e87b1d302f</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;The function you want should be achievable with using just the GPIOTE, a TIMER and the PPI. Please see the attached main-file, which looks something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    ...
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;
    
    NRF_TIMER0-&amp;gt;CC[0] = 100;
    NRF_TIMER0-&amp;gt;CC[1] = 250000;
    NRF_TIMER0-&amp;gt;PRESCALER = 4;
    NRF_TIMER0-&amp;gt;SHORTS = TIMER_SHORTS_COMPARE1_CLEAR_Enabled &amp;lt;&amp;lt; TIMER_SHORTS_COMPARE1_CLEAR_Pos;
    
    nrf_gpiote_task_config(0, OUT_PIN_NUMBER, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_HIGH);
    
    NRF_PPI-&amp;gt;CH[0].EEP = (uint32_t) &amp;amp;NRF_TIMER0-&amp;gt;EVENTS_COMPARE[0];
    NRF_PPI-&amp;gt;CH[0].TEP = (uint32_t) &amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[0];
    NRF_PPI-&amp;gt;CH[1].EEP = (uint32_t) &amp;amp;NRF_TIMER0-&amp;gt;EVENTS_COMPARE[1];
    NRF_PPI-&amp;gt;CH[1].TEP = (uint32_t) &amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[0];
    NRF_PPI-&amp;gt;CHENSET = PPI_CHENSET_CH0_Enabled &amp;lt;&amp;lt; PPI_CHENSET_CH0_Pos | 
                       PPI_CHENSET_CH1_Enabled &amp;lt;&amp;lt; PPI_CHENSET_CH1_Pos;
    
    NRF_TIMER0-&amp;gt;TASKS_START = 1;

    ...

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit: If you want interrupts, it should be sufficient to enable interrupts on the COMPARE events, and then implement a TIMER0_IRQHandler. I haven&amp;#39;t tested this code, but it should be something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;

void TIMER0_IRQHandler(void)
{
    if (NRF_TIMER0-&amp;gt;EVENTS_COMPARE[0] == 1)
    {
        NRF_TIMER0-&amp;gt;EVENTS_COMPARE[0] = 0;
        ...
    } 
    if (NRF_TIMER0-&amp;gt;EVENTS_COMPARE[1] == 1)
    {
        NRF_TIMER0-&amp;gt;EVENTS_COMPARE[1] = 0;
        ...
    }
}
...
    NRF_TIMER0-&amp;gt;INTENSET = TIMER_INTENSET_COMPARE0_Enabled &amp;lt;&amp;lt; TIMER_INTENSET_COMPARE0_Pos |
                           TIMER_INTENSET_COMPARE1_Enabled &amp;lt;&amp;lt; TIMER_INTENSET_COMPARE1_Pos;
    NVIC_EnableIRQ(TIMER0_IRQn);
...

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1526.main.c"&gt;main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>