<?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>[NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15637/nrf51822qfac-sdk11-how-to-recover-uart-errors</link><description>Hi, 
 I&amp;#39;m trying to interface SIM808 with nrf51822 over uart using nrf_drv_uart. Everything works well for some time, but then uart starts reporting error code 1, NRF_UART_ERROR_PARITY_MASK, for all transactions on uart. Re-initializing the uart doesn</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 12 Aug 2016 06:32:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15637/nrf51822qfac-sdk11-how-to-recover-uart-errors" /><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59713?ContentTypeID=1</link><pubDate>Fri, 12 Aug 2016 06:32:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c15503f1-b153-4aa6-829a-2c69912b3497</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;It should be in the nRF51 reference manual, you can download it from the infocenter from &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf51%2Fdita%2Fnrf51%2Fpdflinks%2Fref_manual.html&amp;amp;cp=3_2"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Attaching the image for your convenience.
&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2768.Capture1.JPG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;To flush RX buffer you need to read all the bytes in RX fifo. Unfortunately we do not have any example to handle it. you have to expand our last error handler for it. You can look at the reply to related thread &lt;a href="https://devzone.nordicsemi.com/question/33862/flush-uart/"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59715?ContentTypeID=1</link><pubDate>Fri, 12 Aug 2016 06:13:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd3ff526-b327-4dcc-937a-8dc12fb369c7</guid><dc:creator>Lalit Kumar</dc:creator><description>&lt;p&gt;Looks like OVERRUN error in this case. How can I flush RX buffer in this case? Also please point me to documentation of ERRORSRC register, I&amp;#39;m unable to find it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59714?ContentTypeID=1</link><pubDate>Fri, 12 Aug 2016 06:07:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36cd0a5c-fe3f-4c88-bef7-54db1416744e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;error_mask is just reading UART-&amp;gt;ERRORSRC register, if you read 5 in it it means that both OVERRUN and FRAMING ERROR bit are set. OVERRUN bit is set if you are not reading the RXD fast enough or your peer is transmitting too fast. FRAMING error is when it did not get a stop bit when it expected to get one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59712?ContentTypeID=1</link><pubDate>Thu, 11 Aug 2016 17:34:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05510d07-88a7-4254-bb96-59936030880a</guid><dc:creator>Lalit Kumar</dc:creator><description>&lt;p&gt;I am getting some more errors now which are totally random, some occur after 12 hours. When I resolve the parity error, most of the times uart goes back to functioning properly, but sometimes it goes back to NRF_DRV_UART_EVT_ERROR with the error mask reported as 5. The list of error mask has only 4 entries in the documentation. I tried to create a separate question but the site always reports some internal error and am unable to post, so I&amp;#39;m posting here for now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59707?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 15:27:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cf5c1a8-6f9a-44d3-8b88-bfbc3ea52621</guid><dc:creator>Lalit Kumar</dc:creator><description>&lt;p&gt;yeah no problem :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59706?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 15:04:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3896c827-baa0-4ac7-8077-a7f693aff3db</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Lalit, i edited the subject for this thread so that it is easy to search for others with similar issue, hope that it is ok.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59711?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 11:44:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09e327b3-ec2b-4568-89b5-327c5ba299c2</guid><dc:creator>Lalit Kumar</dc:creator><description>&lt;p&gt;Sorry, forgot to mark as answer. Done. And thanks for help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59710?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 11:43:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:216010e8-1a30-44ad-b803-18be232eeb12</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;good that it worked, thanks for fixing the typo. I have fixed the answer with your correction.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59709?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 11:23:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0bff09c-0a48-4aec-a8e5-639969466360</guid><dc:creator>Lalit Kumar</dc:creator><description>&lt;p&gt;Works like a charm!!! Events clearing was the main issue. I&amp;#39;m still getting parity error on some commands but re-initializing the uart resolves it. Just a minor correction in your solution, a typo:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_uart_event_clear(NRF_UART0, EVENTS_ERROR);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;should be&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59705?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 11:22:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a770f16c-f9ea-4cbf-a526-9ae3a45fa969</guid><dc:creator>Lalit Kumar</dc:creator><description>&lt;p&gt;Works like a charm!!! Events clearing was the main issue. I&amp;#39;m still getting parity error on some commands but re-initializing the uart resolves it. Just a minor correction in your solution, a typo:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_uart_event_clear(NRF_UART0, EVENTS_ERROR);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;should be&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59708?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 10:58:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1c71fec-28e0-4eef-b7b0-5386de1f82e4</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;When you get a parity error you will not get the RX complete event for that particular byte. You should do this in your uart event handler.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void uart_event_handler(nrf_drv_uart_event_t * p_event, void* p_context)
{
   ...
   ...

    else if (p_event-&amp;gt;type == NRF_DRV_UART_EVT_ERROR)
    {
        nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_TXDRDY);
        nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXTO);
        nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR);  /* thanks for correction Lalit*/
        nrf_drv_uart_uninit
        nrf_drv_uart_init
 
    }

   ...
   ...
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59704?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 10:30:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1e4b772-ac17-4f12-bd85-0b3b5bd1a2c6</guid><dc:creator>Lalit Kumar</dc:creator><description>&lt;p&gt;The peer UART is command based, so if a command is completed, it will not broadcast, meaning peer UART is not broadcasting all the times.
I have tried disabling and enabling using nrf_drv_uart_uninit and nrf_drv_uart_init functions, but it doesn&amp;#39;t solve the issue, I haven&amp;#39;t tried clearing the events though. One thing to mention is that I&amp;#39;m disabling/enabling the uart when all the events are complete, RX complete is ensured by using nrf_drv_uart_rx_abort. I am using SDK11, please share code snippet so that I can double check everything.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59703?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 10:19:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65fc714f-2f3e-407f-bd17-68737b1f4736</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Does the peer UART keep on transmitting irrespective of errors happening on nrf side? If not maybe we can handle the PARITY error clearing all events, disabling and enable nRF side uart. Then it will listen to the TX/RX line normally. But if peer is transmitting all time without knowing what is happening on the nRF side, then disabling/enabling will not work because nrf chip will be re-enabled and peer could be in middle of transmitting a byte and that will generate more errors.&lt;/p&gt;
&lt;p&gt;If you need me to help you with code snippets to disable and enable uart then tell mewhich version of SDK drivers you are using.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59702?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 08:31:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14e411f3-733e-43a9-9d48-b572d0296d84</guid><dc:creator>Lalit Kumar</dc:creator><description>&lt;p&gt;nRF51 clock is 16Mhz Xtal, sim808 has an internal clock, specs are not available for that. If I connect other uart device to sim808 module without resetting, it works fine. If I reset the module, then also it works fine. Clock jitter looks prime suspect, but I doubt that can be diagnosed without altering the clock of both modules. Also if I change the baud rate to 460800, error frequency increases, but at bps of 230400, error frequency decreases a lot, minimum error time reduces to 2 hours at 230400. Can anything be done without changing the hardware?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [NRF51822QFAC][SDK11] How to recover Uart errors</title><link>https://devzone.nordicsemi.com/thread/59701?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 08:20:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b63e22d-05f4-4dee-8af4-ee5de0dae8bb</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I am suspecting clock jitter or deviation error. What type of clocks is driving nRF51 and the peer uart? what kind of deviation/jitter could they have?.
You said re-initializing the device in software does not work, but did you try to reset one device and see if it recovers?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>