<?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>nRF52840 Timer peripheral</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22099/nrf52840-timer-peripheral</link><description>I am using the peripheral_timer as a template to play with timers. I changed the timer_ticks to 8000 to generate timer interrupt at 500 micro-seconds. All other timer configurations are left at default. Also, I modified the timer_led_handler to just toggle</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 18 May 2017 09:03:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22099/nrf52840-timer-peripheral" /><item><title>RE: nRF52840 Timer peripheral</title><link>https://devzone.nordicsemi.com/thread/86830?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 09:03:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0f78350-5bc6-4e3a-9d92-f39578379f04</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@KV: If you want a period that you can be guarantee you don&amp;#39;t have interrupt from the softdevice, you can think of using Timeslot. Timeslot is explained in Chapter 9 in the S132 spec. And there is a tutorial for it in the Tutorials section on top of devzone.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Timer peripheral</title><link>https://devzone.nordicsemi.com/thread/86828?ContentTypeID=1</link><pubDate>Tue, 16 May 2017 20:25:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6179f1f0-58bf-4617-81c6-0e6ca40d0356</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;If you run the softdevice it simply locks you out until it is done. Your only interface with the SD is via API&amp;#39;s. This is because the ble coding is highly time dependent.  I should point out that all the microsecond timing in the SD is done with ppi/gpiote. This is because of the unreliable nature of software interrupts.&lt;/p&gt;
&lt;p&gt;According to the blog, the SD spec contains all kinds of tables on interrupt latency. However, if you have highly time dependent activities you should consider letting the ppi/gpiote architecture handle some of it.
Here is a link to the S132 spec for your reference: &lt;a href="http://infocenter.nordicsemi.com/pdf/S132_SDS_v4.0.pdf"&gt;infocenter.nordicsemi.com/.../S132_SDS_v4.0.pdf&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Timer peripheral</title><link>https://devzone.nordicsemi.com/thread/86827?ContentTypeID=1</link><pubDate>Tue, 16 May 2017 19:51:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14acf758-a569-4635-8291-820b98808d0d</guid><dc:creator>KV</dc:creator><description>&lt;p&gt;Are there any critical sections of code in soft device that could disable interrupts for a certain amount of time?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Timer peripheral</title><link>https://devzone.nordicsemi.com/thread/86829?ContentTypeID=1</link><pubDate>Tue, 16 May 2017 19:44:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a4ecab7-dfbd-4302-bc2b-453e975e401b</guid><dc:creator>KV</dc:creator><description>&lt;p&gt;To clarify, the purpose of this test was not to generate signals. I wanted to see what is the maximum time for which the interrupts are disabled by the soft device. Since the soft devices have higher priority, we want to know whether other tasks can meet real time requirements.&lt;/p&gt;
&lt;p&gt;Where can I find these numbers?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Timer peripheral</title><link>https://devzone.nordicsemi.com/thread/86826?ContentTypeID=1</link><pubDate>Tue, 16 May 2017 18:15:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:321daa5a-f2aa-4c27-94dc-8f24c964d9dc</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;You really can&amp;#39;t do that. Software interrupts aren&amp;#39;t intended for microsecond activity. It is just due to the physical requirements of what you are asking the processor to do and has nothing at all to do with Nordic or any other microcontroller SoC.&lt;/p&gt;
&lt;p&gt;Every time the NVIC receives an interrupt request a fairly large amount of work happens.  All the local hardware registers are saved to memory, along with the current program counter and all local variables.  There was a recent discussion about this and the minimum turn around for the NVIC is 12 cycles and that doesn&amp;#39;t include any local variables.  Since the interrupt forces the NVIC to save the last state of the software, now the time to service your interrupt will vary depending on where the program last was and what was going on.  I always assume several hundred cycles will happen before my interrupt in serviced. And, if you are running a SoftDevice then your program interrupt will always wait until the SD is done.&lt;/p&gt;
&lt;p&gt;The second problem with your approach is you are using an example with gpio drivers.  All the drivers utilize function calls, nested within function calls.  While they make it easy to program they do not make the life of the processor easier. Instead, you should be writing directly to the gpio registers.  Then you can accomplish in 1 cycle that which might take hundreds using the drivers.&lt;/p&gt;
&lt;p&gt;The best and most reliable way to do microsecond or even nanosecond timing is using ppi/gpiote.  This allows you to do full hardware implementations of timer/gpio activity.  Since the software only takes on a sort of setup and advisory role using ppi/gpiote, you won&amp;#39;t have the issues associated with software interrupts.&lt;/p&gt;
&lt;p&gt;Here is a link to a recent similar discussion: &lt;a href="https://devzone.nordicsemi.com/question/134566/strange-timer-granularity-issue-on-nrf53832-project/?comment=134571#comment-134571"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>