<?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>Delay implementation from scratch and interrupt handlers</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/56502/delay-implementation-from-scratch-and-interrupt-handlers</link><description>Hello to everyone, 
 I&amp;#39;ve just started playing with NRF52 DK (NRF52832 SoC). It is my first time with ARM MCU. I&amp;#39;ve had prior experience with atmega328p and MSP430. Although I&amp;#39;m not very good at C coding or programming, I&amp;#39;m trying my best. 
 I&amp;#39;ve tried</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 15 Jan 2020 14:06:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/56502/delay-implementation-from-scratch-and-interrupt-handlers" /><item><title>RE: Delay implementation from scratch and interrupt handlers</title><link>https://devzone.nordicsemi.com/thread/229231?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2020 14:06:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b299e10d-4c08-4c8c-a8ec-befc29ad8cdb</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1)&amp;nbsp;I can&amp;#39;t really think of any way to improve this other than&amp;nbsp;using interrupts, no. In order to allow the peripherals to run in the background, without blocking code execution, the interrupts are necessary to alert the MCU that an event has occurred.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The best way to set this up using the standard libraries is to use the app_timer module. Then you can schedule a number of callbacks after a certain delay, or set up callbacks to be run repeatedly. &lt;br /&gt;app_timer uses the RTC module which means the current consumption will be very low.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2) Did you find this case?&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/172/hardware-interrupt-example"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/172/hardware-interrupt-example&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I think the example shared by Håkon is pretty short and concise.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3) Ideally I would recommend the app_timer module, as mentioned earlier. This module has been used by countless customers and is tested thoroughly over time, to make sure it works reliably both with and without a SoftDevice running.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Most interrupt based implementations are reliable as long as the interrupt processing can complete before the next interrupt is about to occur. Put another way, if you expect interrupts every millisecond, and the interrupt processing is delayed by more than a millisecond, then you will normally get into problems.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When using a BLE SoftDevice you should expect interrupts of several hundred microseconds whenever the Bluetooth stack needs to do some critical processing.&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>