<?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>Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10058/reliable-uart-operation-without-handshaking</link><description>I have a small nRF51822 module that I want to use for UART communication without handshaking, and I&amp;#39;m having problems with reliability. Basically the nRF51822 crashes and reboots if I send a burst of data into its UART. 
 I&amp;#39;ve reverted to the ble_peripheral</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Nov 2015 12:51:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10058/reliable-uart-operation-without-handshaking" /><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37286?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 12:51:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbbd1b90-0b2d-4a95-b851-9c2b5e5b6758</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Many thanks for all the help, using your advice and looking at other answers I&amp;#39;ve restructured the code along the lines described at &lt;a href="https://devzone.nordicsemi.com/question/1741/dealing-large-data-packets-through-ble/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;   It now seems a lot more reliable.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37285?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 12:04:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7a4890f-2e78-498d-8578-1fd765409b93</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;That invalid state error is useful if we are trying to send any data before connection is established.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37284?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 12:02:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed90b7f2-7b18-4376-a974-fec43b7ddea4</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;As I mentioned in my comment, 0x3004 is BLE_ERROR_NO_TX_BUFFERS . So the softdevice ran out of TX buffers to transmit your data, which means that UART is sending faster than softdevice could handle.&lt;/p&gt;
&lt;p&gt;When you get this error, your application should stop sending data and wait for BLE_EVT_TX_COMPLETE event. After getting this event it means that there is more room for TX and then more uart data can be transmitted over BLE. Search the forum for this event and you will find tons of information.&lt;/p&gt;
&lt;p&gt;Regarding the system reset APP_ERROR_CHECK macro will do a system reset whenever the error code is not equal to NRF_SUCCESS. You can change this behavior by changing app_error_handler (inside app_error.c) code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37283?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 10:57:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:258744ae-ace3-4ed2-83f6-6204ec34dcdd</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Also the existing call to ble_nus_string_send is followed by a check that throws an error if err_code != NRF_ERROR_INVALID_STATE, rather than NRF_SUCCESS.  The SDK documentation doesn&amp;#39;t explain this (it says ble_nus_string_send should return NRF_SUCCESS).  Can you clarify this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37282?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 10:39:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ea44281-1daf-44d0-a8f4-b8c0553e7762</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Thanks Aryan.  Running the code using the debugger I can see that ble_nus_string_send returns error 0x3004.  However on the next step NVIC_SystemReset is getting called (why?), causing the reboot.&lt;/p&gt;
&lt;p&gt;Can you shed any light on what that error code indicates, and in what way it should be handled to avoid the reset?  Could it be that, when the UART FIFO contains a lot of data, the existing uart_event_handle code is calling ble_nus_string_send too rapidly?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37281?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 09:59:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3339416f-9922-4e51-8b90-21475e696667</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;you are right, This example is not written for bulk data transfer.
There is an error happening in main.c-&amp;gt;uart_event_handle()-&amp;gt;APP_UART_DATA_READY-&amp;gt;ble_nus_string_send-&amp;gt;returns 0x3004 (BLE_ERROR_NO_TX_BUFFERS)&lt;/p&gt;
&lt;p&gt;If you handle it then i guess you are good to go.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37280?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 09:35:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8df9536-9752-499f-b5df-188c318822b4</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;sorry, i missed to see that you said that the flow control is enabled in your update. I will try it out and see&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37279?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 09:07:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f509221d-4a2d-42c8-b363-d76050330bec</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Hi, the issue I described in the update to my question was using Nordic&amp;#39;s ble_app_uart example without any modifications, &lt;strong&gt;with flow control enabled&lt;/strong&gt;, so the code was entirely Nordic&amp;#39;s.  Hence I don&amp;#39;t believe the crashes and reboots can be attributed to my application.&lt;/p&gt;
&lt;p&gt;Could someone at Nordic try to replicate my observations?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37278?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2015 08:49:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c98921a4-8ac0-4f5f-9eb2-ed33188e92fe</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Both Softdevice and UART without handshaking have realtime requirements. And Softdevice will not compromise as it runs on highest priority. It could delay the UART interrupt inside the driver which could make uart data loss. The crashes and reboots must happen in your application.
So the bottom line is this uart driver with flow control disabled + softdevice will not perform well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37277?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2015 16:51:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:477ff993-9d9e-4113-99f8-d5aa74d5e4c2</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;I found that when you do a continuous send with sd_ble_gatts_hvx, the first 6 time no error.  After that it starts returning error.  After the third consecutive error, that fourth one resets the board.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37275?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2015 15:28:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8d208dd-27d8-496a-9d65-2c85217f9f0a</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;I&amp;#39;ve already tried running in debug mode and as far as I could tell there was no assert nor any error codes.  I&amp;#39;ll keep digging into it.&lt;/p&gt;
&lt;p&gt;Regardless, the standard SDK code really ought not to crash - if the UART buffer gets full (and mine was nowhere near full) then I would prefer it to simply ignore any further input or flush the buffer, not reboot!  It would be useful to know how the SDK is supposed to behave in this scenario.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37276?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2015 14:44:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9ec6b19-b305-410d-be0f-38856cb7901b</guid><dc:creator>Alex</dc:creator><description>&lt;p&gt;You need handshaking anyway because MCU/PC which sends data via UART to nRF51 doesn&amp;#39;t know if data passed over to your phone or still in the buffer. If you have hardware limitations and can&amp;#39;t use hardware handshaking you can modify your code to use software habdshaking but throughout will be even lower. But if you know that the buffer is not filled yet then try to run in debug mode and check which code line makes nRF51 crash.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reliable UART operation without handshaking</title><link>https://devzone.nordicsemi.com/thread/37274?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2015 14:15:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c24ac9da-49a5-44f1-9ca3-44f530714c69</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;I&amp;#39;ve found it seems to work more reliably if the baud rate is reduced from the default 38400 to 9600.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>