<?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 is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21104/timer-is-not-stable-phase-duty-change-all-the-time</link><description>Dears,
I am working for an application on nRF51822@v12.0.0 including PWM, Timer and a few peripheral functions. I was trying to create a timer on timer1 in us tick. The timer was created, but not stable. I implemented a pin toggle in timer even handler</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 May 2017 08:10:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21104/timer-is-not-stable-phase-duty-change-all-the-time" /><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82562?ContentTypeID=1</link><pubDate>Thu, 04 May 2017 08:10:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e710ba63-24b9-42a9-85b0-0ab5ffeb5b9f</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;The reason for the seemingly inaccurate timer is because   &amp;quot;software&amp;quot; interrupts/interrupt handler can be somewhat inaccurate because the softdevice has higher priority. To get accurate pin toggling, use ppi and gpiote instead.
I have attached a modified version of your main.c that uses ppi and gpiote to toggle a pin accurately: &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1614.main.c"&gt;main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82561?ContentTypeID=1</link><pubDate>Wed, 03 May 2017 09:26:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad94217c-ab6a-4e6d-ad32-b9d2623598f9</guid><dc:creator>Stanley</dc:creator><description>&lt;p&gt;The following web link is the SDK v12.2.0 tested on nRF52(pca10040) for your reference.
By the way, Have you even an example for a counter to count a duty of pulse?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://app.box.com/s/ahlxo4f8vwhnjovbzmr3m7zo2d7v2vd3"&gt;app.box.com/.../ahlxo4f8vwhnjovbzmr3m7zo2d7v2vd3&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82552?ContentTypeID=1</link><pubDate>Thu, 20 Apr 2017 11:56:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f9b75c6-d4e9-4547-a746-30973bd3250f</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;It was Easter vacation here last week, so I didn&amp;#39;t get a chance to look at your code. Would you mind uploading it again?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82560?ContentTypeID=1</link><pubDate>Mon, 17 Apr 2017 07:55:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:437940fd-a579-4075-b2a9-0a488a7961fb</guid><dc:creator>Stanley</dc:creator><description>&lt;p&gt;Hi Kristin,
Have any advices?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82559?ContentTypeID=1</link><pubDate>Sun, 09 Apr 2017 14:41:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f44ee86-fd64-4159-b1ab-757d7cf21323</guid><dc:creator>Stanley</dc:creator><description>&lt;p&gt;I changed the timer number from 0 to 1. It seems more stable, but some issues came with. The major issue is that the frequency I toggled on P0.07 should be around 50KHz. But it was just around 28KHz. I uploaded another file for your reference. By the way, It would be unstable if I the parameter of time_us to 10.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://app.box.com/s/dkilsil96szkuage6e6i8pega7b39huh"&gt;app.box.com/.../dkilsil96szkuage6e6i8pega7b39huh&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82558?ContentTypeID=1</link><pubDate>Sat, 08 Apr 2017 17:00:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a28611e-367e-4fae-8316-c07a14fb3a8d</guid><dc:creator>Stanley</dc:creator><description>&lt;p&gt;The following web link is the reference file of my tested at my box cloud. Would you download it and check for us?
&lt;a href="https://app.box.com/s/v3vti1ox4h6s55pvn72k5c70nlge58hr"&gt;app.box.com/.../v3vti1ox4h6s55pvn72k5c70nlge58hr&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82557?ContentTypeID=1</link><pubDate>Sat, 08 Apr 2017 16:52:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb47ac42-76cd-4496-8729-61961a31f3b8</guid><dc:creator>Stanley</dc:creator><description>&lt;p&gt;I have tried on the nRF52 EVB(pca10040) to check this issue. It also came out. I will upload the file(main.c) for your reference.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82556?ContentTypeID=1</link><pubDate>Fri, 07 Apr 2017 11:51:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d38c117d-f062-4854-90f7-8a866623a8a3</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;You can create a new support case on myPage from www.nordicsemi.com, upload the file there and refer to this thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82555?ContentTypeID=1</link><pubDate>Fri, 07 Apr 2017 11:28:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2428f683-e822-4e49-9909-14aa44f42924</guid><dc:creator>Stanley</dc:creator><description>&lt;p&gt;I separate the original main.c to several c files. I can send it to you for reference. Where should I send to?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82554?ContentTypeID=1</link><pubDate>Thu, 06 Apr 2017 12:15:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58d2eb54-6c8a-411c-802b-18c06091dad6</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;I would only need the relevant part of main.c, so I can test it here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82553?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 12:57:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:398508d4-bcda-4714-b919-1c4a56d3cc4e</guid><dc:creator>Stanley</dc:creator><description>&lt;p&gt;Hello Kristin,
Thanks for your reply.
Should I open the complete C code to you?  Please let me know if any questions. I have doubt as you mentioned. But also as I mentioned, it will get stable when I changed the priority of Timer to 1.(// &lt;i&gt; Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice)
The value from nrf_drv_timer_us_to_ticks() is 0x140. I think it could the reason of the other timers againsting the timer1 when I set it as priority 3.&lt;/i&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer is not stable(phase/duty change all the time).</title><link>https://devzone.nordicsemi.com/thread/82551?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 10:34:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0afc395-6d2a-417a-a11f-04e5c4af1413</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Could you share more of your code so that it is easier to get an overview?&lt;/p&gt;
&lt;p&gt;It is most likely not related, but what is the value returned by nrf_drv_timer_us_to_ticks()? From what I can see, the arguments should be the time in microseconds and the frequency of the timer..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>