<?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>Conflict between Timer Interrupt and BLE stack?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22531/conflict-between-timer-interrupt-and-ble-stack</link><description>If I use the interrupt handler to set Flag, and read sensors and write data to SD card in the main loop as in the following code then everything works well. 
 #include &amp;lt;Wire.h&amp;gt;
#include &amp;lt;Adafruit_VCNL4010.h&amp;gt;
#include &amp;lt;SPI.h&amp;gt;
#include &amp;lt;SD.h&amp;gt;
#include</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 03 Jun 2017 20:28:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22531/conflict-between-timer-interrupt-and-ble-stack" /><item><title>RE: Conflict between Timer Interrupt and BLE stack?</title><link>https://devzone.nordicsemi.com/thread/88642?ContentTypeID=1</link><pubDate>Sat, 03 Jun 2017 20:28:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c64c350b-1acb-458a-806a-098597d5f754</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;You cannot run any time-consuming action inside interrupt handler because BLE is time-critical and stack (Soft Device) needs to run uninterrupted especially when handling connection interval. So if your read operation is longer then few dozens of microseconds (see more about Soft Device timing and interrupt handling &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.sds/dita/softdevices/s130/processor_avail_interrupt_latency/ble_usage_patterns.html?cp=3_7_2_0_15_2_2"&gt;here&lt;/a&gt;) you should keep processing out of interrupt handler. Usual method is to use scheduler (see it in SDK) or similar method of &amp;quot;set the flag and process it later (as soon as BLE stack gives you more time)&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>