<?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>Is it wrong to send a characteristic notification from inside a timer callback function?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14244/is-it-wrong-to-send-a-characteristic-notification-from-inside-a-timer-callback-function</link><description>In my application I send a characteristic notification from inside a timer callback function. This causes a restart of my application if I am connected to the board. But my application does not restart if I am not connected. What is happening? 
 Is it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Jun 2016 12:20:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14244/is-it-wrong-to-send-a-characteristic-notification-from-inside-a-timer-callback-function" /><item><title>RE: Is it wrong to send a characteristic notification from inside a timer callback function?</title><link>https://devzone.nordicsemi.com/thread/54404?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 12:20:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:584dbc17-bd6d-4686-9fb3-8ebd79e9169c</guid><dc:creator>mosi</dc:creator><description>&lt;p&gt;I have based my service on ble_lbs.c&lt;/p&gt;
&lt;p&gt;Now I added a check in on_write() to see if the cccd was written to so my app can track if the master has enabled notification or not. And I also disable notification after a disconnect. Looks like it is working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it wrong to send a characteristic notification from inside a timer callback function?</title><link>https://devzone.nordicsemi.com/thread/54403?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 12:08:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb68ac24-4404-487f-9ee9-8bbf38391afa</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Yes, the error is thrown by sd_ble_gatts_hvx() and it is the BLE_ERROR_GATTS_SYS_ATTR_MISSING error. It probably occurs because you are trying to send a notification/indication to the client before the client has enabled the CCCD. It is not a critical error though. There are &lt;a href="https://devzone.nordicsemi.com/questions/sort:relevance-desc/query:0x3401/"&gt;lots of Q&amp;amp;As&lt;/a&gt; here on devzone regarding error 0x3401. &lt;a href="https://devzone.nordicsemi.com/question/6085/strange-error-code-13313-0x3401-returned-by-sd_ble_gatts_hvx/"&gt;This might be the best answer&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it wrong to send a characteristic notification from inside a timer callback function?</title><link>https://devzone.nordicsemi.com/thread/54402?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 11:46:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00325221-0f91-4b01-9020-78c331748692</guid><dc:creator>mosi</dc:creator><description>&lt;p&gt;I traced it down and I got error code 13313 (0x3401). I think it was thrown from sd_ble_gatts_hvx().&lt;/p&gt;
&lt;p&gt;After searching old questions I found that I must click the Enable Services button on Master Control Panel.&lt;/p&gt;
&lt;p&gt;Then it worked :-)&lt;/p&gt;
&lt;p&gt;But, is there a way around this so sd_ble_gatts_hvx() wont throw this error if  Enable Services is not enabled?&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t want my app to crash because of this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it wrong to send a characteristic notification from inside a timer callback function?</title><link>https://devzone.nordicsemi.com/thread/54401?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 08:27:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad946615-7e1c-4b3f-a1b1-dc0d21bdebcb</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;No it&amp;#39;s fine to send a characteristic notification from inside a timer callback function. As long as the interrupt context you are in is less than the SVC call interrupt priority, it&amp;#39;s fine. So either that&amp;#39;s not the case and you need to lower the timer interrupt priority, or you are getting an error return from one of your functions, tripping the APP_ERROR_CHECK() and that&amp;#39;s what&amp;#39;s actually restarting the board.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>