<?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>What happens when the scheduler gets full?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35582/what-happens-when-the-scheduler-gets-full</link><description>Hello! 
 On the firmware for a certain product, we are using the scheduler module to manage the access to the peripherals (SPI, TWI, Timer, ...), and have also enabled its use for the SoftDevice. 
 My question is what happens to the Softdevice events</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Jun 2018 12:51:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35582/what-happens-when-the-scheduler-gets-full" /><item><title>RE: What happens when the scheduler gets full?</title><link>https://devzone.nordicsemi.com/thread/136910?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 12:51:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3af82f5-e2b2-4ee3-9526-0b1cc660f9ad</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The SoftDevice events are transferred to the scheduler by simply calling&amp;nbsp;&lt;code&gt;app_sched_event_put()&lt;/code&gt;. In SDK 12.3 this is done by&amp;nbsp;&lt;code&gt;softdevice_evt_schedule()&lt;/code&gt;, which is registered as the event handler, and called from&amp;nbsp;&lt;code&gt;SOFTDEVICE_EVT_IRQHandler()&lt;/code&gt;. If there is an error (e.g. queue full), this will be caught by the error check on line 427 in &lt;code&gt;softdevice_handler.c&lt;/code&gt;&amp;nbsp;&lt;span style="font-family:inherit;"&gt;(For SDK 15 this is similar, but there&amp;nbsp;&lt;code&gt;SD_EVT_IRQHandler()&lt;/code&gt; in &lt;code&gt;nrf_sdh.c&lt;/code&gt; calls&amp;nbsp;&lt;code&gt;app_sched_event_put()&lt;/code&gt; in case&amp;nbsp;&lt;code&gt;NRF_SDH_DISPATCH_MODEL&lt;/code&gt; is set to&amp;nbsp;&lt;code&gt;NRF_SDH_DISPATCH_MODEL_APPSH&lt;/code&gt; in the projects &lt;code&gt;sdk_config.h&lt;/code&gt;).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;As &lt;/span&gt;mentioned&lt;span style="font-family:inherit;"&gt;&amp;nbsp;above, an &lt;code&gt;APP_ERROR_CHECK&lt;/code&gt; will capture the error if &lt;/span&gt;there&lt;span style="font-family:inherit;"&gt;&amp;nbsp;is an error while &lt;/span&gt;attempting&lt;span style="font-family:inherit;"&gt;&amp;nbsp;to put a SoftDevice event to the scheduler queue. The default error handler will reset the device if &lt;code&gt;DEBUG&lt;/code&gt; is not defined. &lt;/span&gt;Alternatively&lt;span style="font-family:inherit;"&gt;, it will enter an eternal loop in the error handler if &lt;code&gt;DEBUG&lt;/code&gt; is defined. You should make sure that the scheduler queue is large enough that this never happen under normal circumstances.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>