<?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>Timer Disturb Main Loop</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24988/timer-disturb-main-loop</link><description>main.c 
 y_timer.c 
 y_timer.h 
 Hi,
I wanted to make the function that get timestamp like mills().
I made this code bellow.
It does&amp;#39;nt move well.
Main loop is unintentionally end, nrf52 is reset.
What brought this on? 
 Thanks, 
 //Code for</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 Sep 2017 01:30:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24988/timer-disturb-main-loop" /><item><title>RE: Timer Disturb Main Loop</title><link>https://devzone.nordicsemi.com/thread/98418?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 01:30:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2315330d-c989-43ee-a822-627df2a11c1d</guid><dc:creator>Sagisawa Yukichi</dc:creator><description>&lt;p&gt;Thank you so much:)!
I did  not know the setting!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Disturb Main Loop</title><link>https://devzone.nordicsemi.com/thread/98417?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 11:33:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef499966-2a11-4584-987f-e89241128ee0</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Just somewhere before you start your timers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Disturb Main Loop</title><link>https://devzone.nordicsemi.com/thread/98416?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 01:36:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:308bc682-8fa0-49ce-bf98-c92550438df3</guid><dc:creator>Sagisawa Yukichi</dc:creator><description>&lt;p&gt;Thanks your comment!
Where your code should I write?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Disturb Main Loop</title><link>https://devzone.nordicsemi.com/thread/98419?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2017 11:25:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd58e56b-3b9b-4b72-be5e-7a015ce19ad2</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;The app_timer library uses RTC1 as a timer and the Low Frequency 32.768kHz clock as the clock source. However, app_timer doesn&amp;#39;t start the LF clock so this has to be done by you. A simple way to do it is like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART = 1;
while(NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED != 1)
{
    ;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Disturb Main Loop</title><link>https://devzone.nordicsemi.com/thread/98415?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 09:48:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e16e9310-29f5-4286-bb41-07d2bcd4233f</guid><dc:creator>Sagisawa Yukichi</dc:creator><description>&lt;p&gt;I attached my code at top of this question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Disturb Main Loop</title><link>https://devzone.nordicsemi.com/thread/98412?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 09:27:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66643e59-98fd-445c-be33-95290bb7e3db</guid><dc:creator>Sagisawa Yukichi</dc:creator><description>&lt;p&gt;I think so, too. I added printf(&amp;quot;ul_pasttime++&amp;quot;); in timer_timeout_handler（void * p_context).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Disturb Main Loop</title><link>https://devzone.nordicsemi.com/thread/98411?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 09:15:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7796cc87-1d1a-4673-9cb1-e7c661754af9</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Strange. The app_timer code looks good. How do you know that the handler is never called? Did you put a breakpoint in it?&lt;/p&gt;
&lt;p&gt;By the way, ul_pasttime should be declared volatile. &lt;a href="https://barrgroup.com/Embedded-Systems/How-To/C-Volatile-Keyword"&gt;Otherwise it might not behave as you would expect when you use it in an interrupt&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Disturb Main Loop</title><link>https://devzone.nordicsemi.com/thread/98414?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 09:02:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a1037ea-66df-48ac-b3a9-cd6396d17ad2</guid><dc:creator>Sagisawa Yukichi</dc:creator><description>&lt;p&gt;Thanks your comment,
I debugged, There was an error at function of device_init (I abridgemed).
The problem of disturb is solved.
But another problem happened.
This code never call timer_timeout_handler(void * p_context).
Please tell me how to rewrite this code correctly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer Disturb Main Loop</title><link>https://devzone.nordicsemi.com/thread/98413?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 15:05:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c2fac7d-7e9a-412e-bb07-3188c2c94478</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Have you tried debugging your code to pinpoint what piece of code causes your chip to reset?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>