<?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>How to recover from nrf_serial driver errors?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39902/how-to-recover-from-nrf_serial-driver-errors</link><description>Hi, 
 I&amp;#39;m using the nRF52840 on a custom board along with an ESP8266 (ESP-12S) Wi-Fi module. 
 The ESP module prints out a bunch of information at a weird nonstandard baud rate when it powers up, and then it switches to 115200. I&amp;#39;ve found that the stuff</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 May 2022 17:01:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39902/how-to-recover-from-nrf_serial-driver-errors" /><item><title>RE: How to recover from nrf_serial driver errors?</title><link>https://devzone.nordicsemi.com/thread/367706?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 17:01:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1547b2bd-2a94-4a7c-a9d6-67696bc26b73</guid><dc:creator>mzarling</dc:creator><description>&lt;p&gt;I had to implement this fix, but found that a delay was necessary between the&amp;nbsp;nrf_serial_uninit(p_serial); and&amp;nbsp;uart_init();&lt;/p&gt;
&lt;p&gt;If this delay was not present, then frequently a&amp;nbsp;NRF_SERIAL_EVENT_RX_DATA event would occur with a byte in the receive FIFO after the uart_init();&lt;/p&gt;
&lt;p&gt;Has anyone else seen this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to recover from nrf_serial driver errors?</title><link>https://devzone.nordicsemi.com/thread/154768?ContentTypeID=1</link><pubDate>Sat, 27 Oct 2018 17:01:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2620873d-36f5-493f-ab90-5909576e54a5</guid><dc:creator>droghio</dc:creator><description>&lt;p&gt;A brief overview is available in the SDK documentation: &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk52.v0.9.2%2Fmodules.html"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk52.v0.9.2%2Fmodules.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;DMA and IRQ functionality is similar, but I believe DMA reduces CPU loading as it can directly dump the results into RAM. Perhaps someone else will be able to offer a better comparison between the two.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to recover from nrf_serial driver errors?</title><link>https://devzone.nordicsemi.com/thread/154765?ContentTypeID=1</link><pubDate>Sat, 27 Oct 2018 14:48:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:649c78fb-8eee-4d10-a3b6-134e9ac9cc89</guid><dc:creator>Glen M</dc:creator><description>&lt;p&gt;That works - thanks!&amp;nbsp; Also, I didn&amp;#39;t realize that DMA was an option for the serial port. How do I know whether I should use DMA mode or IRQ mode? What are the tradeoffs?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to recover from nrf_serial driver errors?</title><link>https://devzone.nordicsemi.com/thread/154736?ContentTypeID=1</link><pubDate>Sat, 27 Oct 2018 01:48:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:981560d6-6cd4-4148-86cc-f385a8794b20</guid><dc:creator>droghio</dc:creator><description>&lt;p&gt;The easiest way is to add a listener for the error event and use it to reinitialize the Serial Driver.&lt;/p&gt;
&lt;p&gt;Depending on how you have setup the driver it can be as easy as:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// If you already have an event callback you just need to add another case.
// I have omiited the lines where I setup the queue and buffer because it
// doesn&amp;#39;t seem applicable to your question.
NRF_SERIAL_CONFIG_DEF(serial_config, NRF_SERIAL_MODE_DMA,
                      &amp;amp;serial_queues, &amp;amp;serial_buffs, &amp;amp;uart_event_handle, NULL);

// Skip a few lines...

void uart_event_handle(struct nrf_serial_s const* p_serial, nrf_serial_event_t event){
    switch (event){
        case NRF_SERIAL_EVENT_DRV_ERR:
            NRF_LOG_INFO(&amp;quot;Serial driver error handler&amp;quot;);
            uint32_t error;
            if(NRF_UART0-&amp;gt;EVENTS_ERROR !=0)
            {
                error = NRF_UART0-&amp;gt;ERRORSRC;
                NRF_LOG_INFO(&amp;quot;Serial driver err: %d&amp;quot;, error);
                NRF_UART0-&amp;gt;EVENTS_ERROR = 0;
            }

            nrf_serial_uninit(p_serial);
            
            uart_init(); // &amp;lt;-- The function you use to configure the uart driver.
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>