<?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>NRF_ERROR_SVC_HANDLER_MISSING error when sending data via UART nRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/64800/nrf_error_svc_handler_missing-error-when-sending-data-via-uart-nrf52840</link><description>Hello, 
 Hardware: nRF52840 
 SKD: nRF5_SDK_16.0.0 
 SoftDevice v7.0.1 
 I am working on creating a multilink central application where my central device connects to 3 peripherals. I used the multilink_central and the ble_app_uart_c examples to start</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 31 Aug 2020 17:49:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/64800/nrf_error_svc_handler_missing-error-when-sending-data-via-uart-nrf52840" /><item><title>RE: NRF_ERROR_SVC_HANDLER_MISSING error when sending data via UART nRF52840</title><link>https://devzone.nordicsemi.com/thread/267311?ContentTypeID=1</link><pubDate>Mon, 31 Aug 2020 17:49:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5f81db4-922c-46b0-985b-23cf12ce0069</guid><dc:creator>AAtpa</dc:creator><description>&lt;p&gt;Thank you Susheel for your &lt;span&gt;suggestions. I was able to run the code without issue by dropping the baud rate from&amp;nbsp;115200 to&amp;nbsp;76800. I am focusing my investigation following your suggestions and also investigating the DLE and MTU connection with all the peripherals.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_SVC_HANDLER_MISSING error when sending data via UART nRF52840</title><link>https://devzone.nordicsemi.com/thread/266868?ContentTypeID=1</link><pubDate>Fri, 28 Aug 2020 06:48:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53c29525-b6f3-4040-b6d1-412c04f75515</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;AAtpa,&lt;/p&gt;
&lt;p&gt;There are only three ways to remove the error.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add HW flow control&lt;/li&gt;
&lt;li&gt;reduce the operational baudrate&lt;/li&gt;
&lt;li&gt;Make sure that the uart post processing of one transaction is faster than the bytes received into the FIFO (including worst case scenarios of any other higher priority context stealing the CPU).&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The 3rd one will be very hard for you to fine tune and would need you to understand the details timings of all the BLE activity. it would also need you to optimize your UART RX post processing to a bare minimal in the interrupt context.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_SVC_HANDLER_MISSING error when sending data via UART nRF52840</title><link>https://devzone.nordicsemi.com/thread/266833?ContentTypeID=1</link><pubDate>Thu, 27 Aug 2020 19:56:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4aee871-179b-4e2c-a76d-9ca9c1d503a4</guid><dc:creator>AAtpa</dc:creator><description>&lt;p&gt;Hi Susheel, sorry for the confusion. I added that while loop there just to verify if the FIFO was full at the moment of getting the error. This loop is not intended to be part of the final coded.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I ran an additional test reducing the baud rate from 115200 to 9600 to verify if the error was still present. After a couple of hours running multiple tests, I didn&amp;#39;t see the error even once. This indicates, as you mentioned above, that the error may be originated at the moment of reading the UART. Do you have any other suggestions that I could try at this point?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_SVC_HANDLER_MISSING error when sending data via UART nRF52840</title><link>https://devzone.nordicsemi.com/thread/265217?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2020 06:40:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:471db7cb-b7f2-4e00-993a-4a0fb16d952d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;You have a&amp;nbsp;while(app_uart_fifo_free(output_length) &amp;lt; 0) {} instide an event handler which is an interrupt handler? Normally you should avoid as much as possible any busy waiting or and busy loops inside any interrupt handlers (events come to application in the SWI interrupt context). Many times they cause deadlocks or timeouts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_SVC_HANDLER_MISSING error when sending data via UART nRF52840</title><link>https://devzone.nordicsemi.com/thread/264862?ContentTypeID=1</link><pubDate>Mon, 17 Aug 2020 12:32:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ac57dc8-6a7c-476c-9e26-fd261b132493</guid><dc:creator>AAtpa</dc:creator><description>&lt;p&gt;Hi Susheel, thank you for the recommendations. By increasing the UART priority fixed the issue of the error appearing randomly after all connections were fully successful. Unfortunately, the error still happening when I use the UART at BLE_GAP_EVT_AUTH_STATUS while establishing the connection to a peripheral.&lt;/p&gt;
&lt;p&gt;I included a function on app_uart_fifo.c following t&lt;span&gt;he code from&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/lib_fifo.html?cp=4_0_2_3_14_7#lib_app_fifo_size"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/lib_fifo.html?cp=4_0_2_3_14_7#lib_app_fifo_size&lt;/a&gt;&lt;span&gt;&amp;nbsp; to verify if the FIFO was full before sending the message. But, it doesn&amp;#39;t appear it is my issue since I am still getting the error.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;while(app_uart_fifo_free(output_length) &amp;lt; 0){}

// Send response.
ret_code_t ret_val;
for(uint32_t i = 0; i &amp;lt; output_length; i++){
    do
    {
        ret_val = app_uart_put(output_buffer[i]);
        if ((ret_val != NRF_SUCCESS) &amp;amp;&amp;amp; (ret_val != NRF_ERROR_BUSY))
        {
            NRF_LOG_ERROR(&amp;quot;app_uart_put failed for index 0x%04x.&amp;quot;, i);
            APP_ERROR_CHECK(ret_val);
        }
    } while (ret_val == NRF_ERROR_BUSY);
}

...

int32_t app_uart_fifo_free(uint32_t needed_size)
{
   uint32_t err_code;
   uint32_t data_len;

   // Request number of elements that can be written to the FIFO
   err_code = app_fifo_write(&amp;amp;m_tx_fifo, NULL, &amp;amp;data_len);
   
   // Check if request was successful
   if (err_code == NRF_ERROR_NO_MEM || needed_size &amp;gt; data_len)
   {
      // FIFO is full
      return -1;
   }
   else if (err_code == NRF_SUCCESS)
   {
      // data_len contains the number of bytes that can be written
      return data_len;
   }
   else
   {
      // API parameters incorrect, should not happen
      return -2;
   }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_SVC_HANDLER_MISSING error when sending data via UART nRF52840</title><link>https://devzone.nordicsemi.com/thread/264574?ContentTypeID=1</link><pubDate>Fri, 14 Aug 2020 08:41:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e54df57d-18d2-472a-a180-2b65282fdfcc</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi AAtpa&lt;/p&gt;
[quote user=""]&amp;nbsp;I get the&amp;nbsp;&lt;span&gt;NRF_ERROR_SVC_HANDLER_MISSING&amp;nbsp;error in APP_UART_COMMUNICATION_ERROR when I use the UART to send data&lt;/span&gt;[/quote]
&lt;p&gt;I think the error here is a bit misleading. When you get&amp;nbsp;&amp;nbsp;&lt;span&gt;APP_UART_COMMUNICATION_ERROR&amp;nbsp; the error number that is passed to the APP_ERROR_HANDLER is&amp;nbsp;&lt;/span&gt;&lt;span&gt;p_event&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;data&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;error&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;error_mask which is equal to&amp;nbsp;&lt;/span&gt;&lt;span&gt;nrf_uarte_errorsrc_get_and_clear&lt;/span&gt;&lt;span&gt;(p_uarte); from the nrfx_uartx.c . This is the value of the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fuart.html&amp;amp;cp=4_0_0_5_32_9&amp;amp;anchor=register.ERRORSRC"&gt;ERRORSRC &lt;/a&gt;register of the UART with BIT A set. This is the OVERRUN error. The error number 1 in APP_ERROR_CHECK is misleading but let us focus on the main problem.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The main problem you have is the overrun error. This is caused mostly when you do not have hardware flowcontrol and your application/uart_driver is not able to pull enough bytes in time from the RX register of the uart. There are many reasons why this happens but mostly due to higher priority contexts not giving uart driver CPU time to pull data. I would suggest you to try to init the uart with higher priority&amp;nbsp;&lt;/span&gt;APP_IRQ_PRIORITY_HIGH. This is the best shot we have without the flow control, giving the uart_drv a bit higher priority (still lower than SD BLE activity) and we can this way reduce the probability of this error.&lt;/p&gt;
&lt;p&gt;Irrespective of that, I would suggest you to handle this error gracefully in your application since without flowcontrol, there is always a possibility of overrun error and you should handle this in your application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>