<?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>Wakeup the nrf51422 with UART pins.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49220/wakeup-the-nrf51422-with-uart-pins</link><description>Hello All, 
 
 Currently i am working on nrf51422 DK board(PCA10028). I am using SDK 12.3.0 ,from this i have referred the ble_app_uart example for implementing the UART and it is working fine. 
 As per our application i want to the wakeup the BLE from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 03 Jul 2019 12:41:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49220/wakeup-the-nrf51422-with-uart-pins" /><item><title>RE: Wakeup the nrf51422 with UART pins.</title><link>https://devzone.nordicsemi.com/thread/196259?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2019 12:41:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88f7da21-9f1a-42c0-87d4-5105b57fb85f</guid><dc:creator>awneil</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/49220/wakeup-the-nrf51422-with-uart-pins/196249"]it was the communication error event that caused the reset[/quote]
&lt;p&gt;This is a known &amp;quot;feature&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/45287/how-to-handle-the-crash-about-app_uart_communication_error/177948#177948"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/45287/how-to-handle-the-crash-about-app_uart_communication_error/177948#177948&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/41480/multiperipheral-nus-crashes/161714#161714"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/41480/multiperipheral-nus-crashes/161714#161714&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/40697/how-to-resolve-the-error-nrf_error_no_mem-at-the-case-app_uart_communication_error-in-uart_event_handle/160847#160847"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/40697/how-to-resolve-the-error-nrf_error_no_mem-at-the-case-app_uart_communication_error-in-uart_event_handle/160847#160847&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I would call it a bug - such comms errors should not be fatal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wakeup the nrf51422 with UART pins.</title><link>https://devzone.nordicsemi.com/thread/196249?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2019 12:08:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c3e9356-9cba-45c4-9b0c-e3195c90164f</guid><dc:creator>Edvin</dc:creator><description>[quote user="Amit_ P"]Kindly give your feedback for the same.[/quote]
&lt;p&gt;&amp;nbsp;I&amp;#39;m not sure I understand.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But yes. Then it was the communication error event that caused the reset. So now that you know the reason for this event, you can at least &amp;quot;ignore&amp;quot; the first time this occurs after a system_off wakeup.&lt;/p&gt;
&lt;p&gt;&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><item><title>RE: Wakeup the nrf51422 with UART pins.</title><link>https://devzone.nordicsemi.com/thread/196222?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2019 10:00:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9eb5aa0-77ed-4a81-81a3-7c14e85fedb2</guid><dc:creator>Amitkumar</dc:creator><description>&lt;p&gt;Dear Edvin,&lt;/p&gt;
&lt;p&gt;Yes the system reset is doen&amp;#39;t occur only when the i comment&amp;nbsp;&lt;span&gt;APP_ERROR_CHECK() at uart handler.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am compiling the code in&amp;nbsp; IAR v8.30.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kindly give your feedback for the same.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Amit&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wakeup the nrf51422 with UART pins.</title><link>https://devzone.nordicsemi.com/thread/196180?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2019 08:43:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3732c452-cca3-42e9-b2d1-e446ea6d06b3</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;2)&lt;/p&gt;
&lt;p&gt;I only suggested changing the optimization level in order to see what the p_event-&amp;gt;data.error_communication value was when you were debugging. Does the issue disappear if you only change the optimization level, and not comment out the APP_ERROR_CHECK(p_event-&amp;gt;data.error_communication)?&lt;/p&gt;
&lt;p&gt;1)&lt;/p&gt;
&lt;p&gt;What APP_ERROR_CHECK(err_code) does is to reset the device if (err_code) is not 0. It may be desirable in some cases, but not necessarily all. If you are aware that this will happen there is no need to reset the device, but rather use this event to tell the application that something happened.&lt;/p&gt;
&lt;p&gt;One classic example is when you queue too many packets in BLE, and you get the return value NRF_ERROR_RESOURCES from the sd_ble_gatts_hvx(), and pass this into APP_ERROR_CHECK() the device will reset. In this case it would be better to use this return code to know that the last packet was not queued, and try to queue it later, rather than restarting the device, causing the BLE link to disconnect, and start from scratch.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So unless a restart solves the issue, it is better to just be aware of these events, rather than restarting. However, it is quite useful during development, to make sure that the developer is aware of these events.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Sorry for the digression. Back to the issue. Does only changing optimization level solve the issue? Or does it only go away if you also comment out that APP_ERROR_CHECK()?&lt;/p&gt;
&lt;p&gt;If only optimization level does the trick, what compiler do you use (if armgcc, what version)?&lt;/p&gt;
&lt;p&gt;It may also be related to compiler warnings if optimization level changes the behavior. Try to rebuild your project from scratch, and see if you get any compiler warnings.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wakeup the nrf51422 with UART pins.</title><link>https://devzone.nordicsemi.com/thread/196015?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2019 13:17:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:491c465b-1694-4c39-a13c-572e105978ac</guid><dc:creator>Amitkumar</dc:creator><description>&lt;p&gt;Dear Edvin,&lt;/p&gt;
&lt;p&gt;Thanks for response.&lt;/p&gt;
&lt;p&gt;I have changed the Optimization level to zero and it&amp;#39;s working fine. It wake up on driving low and also sending strings through uart after initialization.&amp;nbsp; However i have few question regarding this.&lt;/p&gt;
&lt;p&gt;1. is it okay to comment the&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;strong&gt;APP_ERROR_CHECK(p_event-&amp;gt;data.error_communication)&amp;nbsp;?&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;2. Why the code is working fine after changing optimization level?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards ,&lt;/p&gt;
&lt;p&gt;Amit&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wakeup the nrf51422 with UART pins.</title><link>https://devzone.nordicsemi.com/thread/195987?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2019 12:33:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71ea7711-2394-4d0d-a385-ff806a02968f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Looking at the struct app_uart_evt_t in app_uart.h on line 118, it says that the APP_UART_COMMUNICATION_ERROR event contains the value of the ERRORSRC from the UART peripheral, which you can see in Table 279 in the &lt;a href="https://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.1.pdf?cp=4_2_0" rel="noopener noreferrer" target="_blank"&gt;reference manual&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So, 12 = 0xb1100, meaning D=1, C=1, B=0, A=0 (in the table).&lt;/p&gt;
&lt;p&gt;D means that it is a break, which is what you are seeing. C means &amp;quot;Framing error&amp;quot;, which is caused by that the data doesn&amp;#39;t seem to fit with the baudrate of the UART. This is probably because it takes some time to start up the UART, and the nRF thinks that the first bit is too short.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Amit_ P"]still it reset the controller Kindly give your feedback for the same.[/quote]
&lt;p&gt;&amp;nbsp;Can you try to:&lt;/p&gt;
&lt;p&gt;1: disable optimization in your project, and&lt;/p&gt;
&lt;p&gt;2: define DEBUG in your preprocessor defines.&lt;/p&gt;
&lt;p&gt;Then set a breakpoint on line 76 in app_error.c. Does it stop at this breakpoint? If so it should point to a place in your project. What is .line_num, p_file_name, and .err_code? and what is the function that returned the err_code that was passed into APP_ERROR_CHECK() on this place in your project?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wakeup the nrf51422 with UART pins.</title><link>https://devzone.nordicsemi.com/thread/195977?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2019 12:11:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8859695a-323c-4d65-9be7-0bb188174a29</guid><dc:creator>Amitkumar</dc:creator><description>&lt;p&gt;Dear Edvin,&lt;/p&gt;
&lt;p&gt;Thanks for your Kind Response!!!&lt;/p&gt;
&lt;p&gt;Yes ,the&amp;nbsp;&lt;span&gt;APP_UART_COMMUNICATION_ERROR&amp;nbsp; event inside the uart event handler causing the reset of the controller.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The value i got from&amp;nbsp;&amp;nbsp;p_event-&amp;gt;data.error_communication is 12 ,i don&amp;#39;t know what it means. I also comment the&amp;nbsp;APP_ERROR_CHECK(p_event-&amp;gt;data.error_communication) ,still it reset the controller Kindly give your feedback for the same. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Amit&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wakeup the nrf51422 with UART pins.</title><link>https://devzone.nordicsemi.com/thread/195948?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2019 10:55:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2f1fd24-2cdb-4a18-80a9-06614d7ecbcc</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Amit,&lt;/p&gt;
[quote user=""]The problem is occurring that when it wakes up from the system off mode and when it try to configure the wakeup pin as uart the system reset occur.[/quote]
&lt;p&gt;Is that the&amp;nbsp;&amp;nbsp;APP_UART_COMMUNICATION_ERROR event inside your uart event handler that resets the controller? If so, can you try to just print out the&amp;nbsp;p_event-&amp;gt;data.error_communication in the log (or debug to see what it is), instead of passing it into the APP_ERROR_CHECK(p_event-&amp;gt;data.error_communication)?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Printing it just to see what reason it is. What I really want to know is whether it behaves properly if you just remove the APP_ERROR_HANDLER(p_event-&amp;gt;data.error_communication); inside the APP_UART_COMMUNICATION_ERROR event in your uart event handler.&lt;/p&gt;
&lt;p&gt;&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>