<?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>UART crash when incompatible baud rate is set</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36113/uart-crash-when-incompatible-baud-rate-is-set</link><description>Hi, 
 
 I am connecting the nRF52832 UART (on my nRF52 DK) to an external device, which by default uses 9600 baud rate (but can be reconfigured differently). 
 In the case that the UART on the nRF is configured to 115200, and once the first character</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 16 Jul 2018 13:08:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36113/uart-crash-when-incompatible-baud-rate-is-set" /><item><title>RE: UART crash when incompatible baud rate is set</title><link>https://devzone.nordicsemi.com/thread/140212?ContentTypeID=1</link><pubDate>Mon, 16 Jul 2018 13:08:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a915e6ae-25a3-4a0a-b436-bba962fb8a8d</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. We are a bit short staffed during the summer vacation.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I understand. It sounds like you could use the APP_COMMUNICATION_ERROR event to detect when the other device has reset.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I suggest that you do something like this (pseudo):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;case APP_COMMUNICATION_ERROR:
    if (p_event-&amp;gt;data.error_communication == framing error)
    {
        change_to_9600_baud();
        update_device_to_115200();
        change_to_115200_baud();
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As mentioned, the reason for the reset is because the error is passed on to APP_ERROR_HANDLER(). This will cause a reset. It is good for debugging and development, but it might not be a good thing in a product. It is better to&amp;nbsp;use the APP_UART_COMMUNICATION_ERROR event to tell the application that something is wrong, and handle it properly. In your case, you can use it to detect the faulty baud rate, and an indication that the other device has reset, instead of resetting the nRF device as well.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART crash when incompatible baud rate is set</title><link>https://devzone.nordicsemi.com/thread/139414?ContentTypeID=1</link><pubDate>Mon, 09 Jul 2018 12:17:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a64a0ba5-9e5b-40c0-af46-35edd16e60a0</guid><dc:creator>MosheH</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;In addition to the above, the same framing UART error occurs also in the case that both parties are using the same baud rate (9600 in my case), but the nRF52 is being setup during a transmission of the external device, thus, once the external device is in the middle of transmitting its message over the UART interface while the nRF52 is initialized (using&amp;nbsp;app_uart_init()), the nRF52 crashes.&lt;/p&gt;
&lt;p&gt;Again, I will &lt;span&gt;appreciate&amp;nbsp;&lt;/span&gt;your help on solving this issue.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Moshe&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART crash when incompatible baud rate is set</title><link>https://devzone.nordicsemi.com/thread/139340?ContentTypeID=1</link><pubDate>Sun, 08 Jul 2018 12:00:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e25a1ce-c44a-4133-9c31-681943126733</guid><dc:creator>MosheH</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;The error_communication value refers to the framing error.&lt;/p&gt;
&lt;table class="table register" id="register.ERRORSRC__ERRORSRC" border="1" cellpadding="4" cellspacing="0" frame="border" rules="all" summary=""&gt;
&lt;tbody class="tbody"&gt;
&lt;tr class="row field"&gt;
&lt;td class="entry" colspan="1" headers="d19014343e4325 d19014343e4432 d19014343e4511 d19014343e4618" rowspan="1" valign="top" width="3.205128205128205%"&gt;C&lt;/td&gt;
&lt;td class="entry" colspan="1" headers="d19014343e4325 d19014343e4432 d19014343e4511 d19014343e4621" rowspan="1" valign="top" width="3.205128205128205%"&gt;RW&lt;/td&gt;
&lt;td class="entry" colspan="1" headers="d19014343e4325 d19014343e4432 d19014343e4511 d19014343e4624" rowspan="1" valign="top" width="16.025641025641026%"&gt;
&lt;p class="p"&gt;FRAMING&lt;/p&gt;
&lt;/td&gt;
&lt;td class="entry" colspan="1" headers="d19014343e4325 d19014343e4432 d19014343e4511 d19014343e4627" rowspan="1" valign="top" width="16.025641025641026%"&gt;&amp;nbsp;&lt;/td&gt;
&lt;td class="entry" colspan="8" headers="d19014343e4328 d19014343e4331 d19014343e4334 d19014343e4337 d19014343e4341 d19014343e4344 d19014343e4347 d19014343e4350 d19014343e4435 d19014343e4437 d19014343e4439 d19014343e4441 d19014343e4444 d19014343e4446 d19014343e4448 d19014343e4450 d19014343e4514 d19014343e4517 d19014343e4520 d19014343e4523 d19014343e4527 d19014343e4530 d19014343e4533 d19014343e4536 d19014343e4630" rowspan="1" valign="top"&gt;&amp;nbsp;&lt;/td&gt;
&lt;td class="entry" colspan="20" headers="d19014343e4353 d19014343e4356 d19014343e4360 d19014343e4363 d19014343e4366 d19014343e4369 d19014343e4372 d19014343e4375 d19014343e4379 d19014343e4382 d19014343e4385 d19014343e4388 d19014343e4391 d19014343e4394 d19014343e4398 d19014343e4401 d19014343e4404 d19014343e4407 d19014343e4410 d19014343e4413 d19014343e4452 d19014343e4454 d19014343e4457 d19014343e4459 d19014343e4461 d19014343e4463 d19014343e4465 d19014343e4467 d19014343e4470 d19014343e4472 d19014343e4474 d19014343e4476 d19014343e4478 d19014343e4480 d19014343e4483 d19014343e4485 d19014343e4487 d19014343e4489 d19014343e4491 d19014343e4493 d19014343e4539 d19014343e4542 d19014343e4546 d19014343e4549 d19014343e4552 d19014343e4555 d19014343e4558 d19014343e4561 d19014343e4565 d19014343e4568 d19014343e4571 d19014343e4574 d19014343e4577 d19014343e4580 d19014343e4584 d19014343e4587 d19014343e4590 d19014343e4593 d19014343e4596 d19014343e4599 d19014343e4634" rowspan="1" valign="top"&gt;
&lt;p class="p"&gt;Framing error occurred&lt;/p&gt;
&lt;p class="p"&gt;A valid stop bit is not detected on the serial data input after all bits in a character have been received.&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;I guess this is due to the baud rate mismatch.&lt;/p&gt;
&lt;p&gt;The actual problem I am facing in my application is that the device I am working with uses a 9600 as default and I need to configure it to 115200 (by sending it a configuration message over the link). So, once it was set to 115200, I reconfigure my UART to 115200 and start exchanging messages with it. Yet, in case for some reason this device is reset and go back to its default 9600, I have no way to know that the baud rate was changed and thus puts me in the position where I am still using 115200 and the device is using 9600, which then leads to the crash.&lt;/p&gt;
&lt;p&gt;Thus, I would expect that when such mismatch will no cause the fatal error and allow me to realize that the rate was changed and start the reconfiguration process again.&lt;/p&gt;
&lt;p&gt;Any advice will be appreciated.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Moshe&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART crash when incompatible baud rate is set</title><link>https://devzone.nordicsemi.com/thread/139135?ContentTypeID=1</link><pubDate>Thu, 05 Jul 2018 14:33:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f633d890-0251-4a70-9656-6feb177111b2</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Moshe,&lt;/p&gt;
&lt;p&gt;Depends on the error. You can try to debug and find the value of the p_event-&amp;gt;data.error_communication. This value should be the value in the&amp;nbsp;ERRORSRC for the UART peripheral. You can see what the different bits mean &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fuart.html&amp;amp;cp=2_1_0_49_9_3&amp;amp;anchor=register.ERRORSRC" target="_blank" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART crash when incompatible baud rate is set</title><link>https://devzone.nordicsemi.com/thread/139132?ContentTypeID=1</link><pubDate>Thu, 05 Jul 2018 14:16:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2978ed0-4a02-4867-aa8e-3a5c1be2e926</guid><dc:creator>MosheH</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;What is causing this error in the first place? Usually, mismatch in baud rates just corrupts the data and not resulting in such error.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Moshe&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART crash when incompatible baud rate is set</title><link>https://devzone.nordicsemi.com/thread/139131?ContentTypeID=1</link><pubDate>Thu, 05 Jul 2018 14:11:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bb53ec5-c7b8-421f-9683-0002b91810dc</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t want the application to stop on the&amp;nbsp;&lt;strong&gt;APP_UART_COMMUNICATION_ERROR&lt;/strong&gt;&amp;nbsp;you must remove the APP_ERROR_HANDLER(p_event-&amp;gt;data.error_communication); inside the APP_UART_COMMUNICATION_ERROR event.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>