<?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>SysTick timer on nRF52 fires 1/5 as often as expected</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10042/systick-timer-on-nrf52-fires-1-5-as-often-as-expected</link><description>Hi, 
 I&amp;#39;m trying to use the SysTick timer on nRF52 to time some various tasks for debugging. I configured it like so, which I expected would cause SysTick_Handler to be called every 1ms (SystemCoreClock is indeed 64000000): 
 SysTick_Config(SystemCoreClock</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 May 2017 19:42:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10042/systick-timer-on-nrf52-fires-1-5-as-often-as-expected" /><item><title>RE: SysTick timer on nRF52 fires 1/5 as often as expected</title><link>https://devzone.nordicsemi.com/thread/37222?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 19:42:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d375fca-c27e-4ad8-b98f-eef0f7e7087c</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I have found a thread that (possibly) explains why the systick is slowed down in CPU sleep &lt;a href="https://electronics.stackexchange.com/questions/186409/wfi-instruction-slowing-down-systick-interrupt"&gt;here&lt;/a&gt;.
Probably someone case test the solution?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SysTick timer on nRF52 fires 1/5 as often as expected</title><link>https://devzone.nordicsemi.com/thread/37221?ContentTypeID=1</link><pubDate>Mon, 16 Nov 2015 07:54:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efeb9dd1-730e-4b5f-8312-9deec174f8fd</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;SysTick is based on the CPU frequency (64M), which nordic turns off during sleep to ensure that the power consumption is low. The systick implementation and how it&amp;#39;s sourced (ie: during sleep or not) is implementation specific.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SysTick timer on nRF52 fires 1/5 as often as expected</title><link>https://devzone.nordicsemi.com/thread/37220?ContentTypeID=1</link><pubDate>Mon, 16 Nov 2015 06:28:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f85f8ec-3ecf-41c9-88c6-29fa2d3622f6</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;blockquote&gt;
&lt;p&gt;Apparently, __WFE slows down the system clock which affects the SysTick frequency&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Could you please give a reference to this behaviour. Is it documented in ARM infocenter?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SysTick timer on nRF52 fires 1/5 as often as expected</title><link>https://devzone.nordicsemi.com/thread/37219?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 22:10:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3cbc14b9-3aca-4a01-982c-b49d5f3bc7a8</guid><dc:creator>Mike Voytovich</dc:creator><description>&lt;p&gt;Hi @Håkon Alseth - thanks for your reply and for testing this!  I was also able to reproduce your results using blinky.&lt;/p&gt;
&lt;p&gt;It turns out my issue was caused by my app calling &lt;code&gt;sd_app_evt_wait()&lt;/code&gt; in the main loop, which calls &lt;code&gt;__WFE()&lt;/code&gt;.  Apparently, &lt;code&gt;__WFE&lt;/code&gt; slows down the system clock which affects the SysTick frequency.&lt;/p&gt;
&lt;p&gt;If I omit &lt;code&gt;sd_app_evt_wait()&lt;/code&gt; from my application, the counter increments at the expected rate.&lt;br /&gt;
Thanks again for testing this out, it really helped to figure out the issue!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SysTick timer on nRF52 fires 1/5 as often as expected</title><link>https://devzone.nordicsemi.com/thread/37218?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 14:47:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c403b685-b37e-4875-ba2f-cb3a9e7b19aa</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Seems to work fine at my end.
Here&amp;#39;s my code-snippet (based on blinky):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;const uint8_t leds_list[LEDS_NUMBER] = LEDS_LIST;

static uint32_t m_systick_cnt;

void SysTick_Handler(void) {
    m_systick_cnt++;
    if ((m_systick_cnt % 100) == 0)
        nrf_gpio_pin_toggle(BSP_LED_0); 
}

int main(void)  
{
    // Configure LED-pins as outputs.
    LEDS_CONFIGURE(LEDS_MASK);
    SysTick_Config(64000);
    NVIC_EnableIRQ(SysTick_IRQn);
    while (true);      
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And here&amp;#39;s the measured interval, based on 100 ticks:
&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/systick_5F00_nrf52832.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Cheers,
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SysTick timer on nRF52 fires 1/5 as often as expected</title><link>https://devzone.nordicsemi.com/thread/37217?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 21:46:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4af71a78-b9f4-4284-9465-ef0097e71787</guid><dc:creator>Mike Voytovich</dc:creator><description>&lt;p&gt;Hi @Martijn - I&amp;#39;m using a uint32_t for the counter in the SysTick_Handler interrupt (I expected it to increment by 1000 every second).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SysTick timer on nRF52 fires 1/5 as often as expected</title><link>https://devzone.nordicsemi.com/thread/37216?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 20:13:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:395a8c81-747e-466a-bdd5-616fff744240</guid><dc:creator>Martijn</dc:creator><description>&lt;p&gt;Are you using a big enough variable to store your counter value? If you use a uint8_t you will get a value of 232...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SysTick timer on nRF52 fires 1/5 as often as expected</title><link>https://devzone.nordicsemi.com/thread/37215?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2015 17:07:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65e05967-6d0f-40ad-92f5-391d7de0274c</guid><dc:creator>Mike Voytovich</dc:creator><description>&lt;p&gt;Thanks for the reply @Aryan.  Yes, I&amp;#39;m sure app_timer is configured correctly for 1s (it&amp;#39;s easy to verify 30 timer events occurring over 30 seconds with a stopwatch).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SysTick timer on nRF52 fires 1/5 as often as expected</title><link>https://devzone.nordicsemi.com/thread/37214?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2015 08:53:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5325f8b4-88ba-4af1-bda7-6a9b3a84b21e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;This is ARM-CM4 feature, so we should not have any PAN&amp;#39;s on it.
Are you sure that you have configured app_timer correctly for 1 second?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>