<?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>AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12547/avr-uart-regarding-rts-cts</link><description>I am using a nRF51 dongle as a BLE tranciever and using UART to communicate with an 8bit AVR. I used BLE_APP_UART peripheral example and mostly just changed the pins used for commuincation from the USB pins to some GPIO pins, and added the segger RTT</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Apr 2016 09:29:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12547/avr-uart-regarding-rts-cts" /><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47623?ContentTypeID=1</link><pubDate>Fri, 01 Apr 2016 09:29:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8dda6aa4-3861-4d2d-9569-29db5cddc45c</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Ok, but is the nRF receiving all the bytes? Try printing out the bytes to a terminal as you receive them using uart or RTT.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47625?ContentTypeID=1</link><pubDate>Fri, 01 Apr 2016 08:38:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57d42475-6cb9-4323-b612-04d6cb506585</guid><dc:creator>erltot</dc:creator><description>&lt;p&gt;Correct. I am using another mcu to &amp;quot;spy&amp;quot; on the uart between avr and nrf and it shows the messages the way I expect&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47624?ContentTypeID=1</link><pubDate>Fri, 01 Apr 2016 07:56:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc93029e-92b2-4297-9409-482ebfb5faae</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Looks more like you are missing some parts instead of wrong order. This may be due to no hardware flow control (you didn&amp;#39;t use that right?). Could you check that everything is received on the uart?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47622?ContentTypeID=1</link><pubDate>Thu, 31 Mar 2016 18:22:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b655d74-bbda-4e25-8a34-6620dec05cad</guid><dc:creator>erltot</dc:creator><description>&lt;p&gt;It&amp;#39;s almost working. Instead of crashing it sends some parts of the string in the wrong order after a while;
Sending &amp;quot;A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \r\n&amp;quot; every 200 ms:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;...    
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
A B C D E F G H I J U V W X Y Z 
K L M N O P Q R S T A B C N O P Q R S T U V W J K L M X Y Z
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47626?ContentTypeID=1</link><pubDate>Thu, 31 Mar 2016 16:06:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1f1c795-d536-478a-9361-e898a0b1f8fb</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Something like this: &lt;a href="http://pastebin.com/ETYguyPd"&gt;http://pastebin.com/ETYguyPd&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47621?ContentTypeID=1</link><pubDate>Thu, 31 Mar 2016 15:54:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6e7d139-a635-4e98-9c60-e45ac6f4eb49</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;You will get the best throughput with S130 v2 at the master and either s110 or s130 v2 at the peripheral. S120 will not give you better throughput.&lt;/p&gt;
&lt;p&gt;20 byte packet is 20 bytes, a 20 character string will be 21 bytes due to the null terminator.&lt;/p&gt;
&lt;p&gt;Error code 7 means &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s110.api.v8.0.0/group__nrf__error.html#ga0a5831cf5092e0dd43a01869676ee076"&gt;NRF_ERROR_INVALID_PARAM&lt;/a&gt;. Which is probably because length is greater than BLE_NUS_MAX_DATA_LEN (see in ble_nus_string_send function).&lt;/p&gt;
&lt;p&gt;Your code will most likely wait for very long time in while(true) statement in uart_send_flowcontrol(). In this case it is better to have another approach: If BLE_ERROR_NO_TX_PACKET is received store the packet in a buffer (f.ex. use app_fifo). When BLE_EVT_TX_COMPLETE is received check if there are any packets in the buffer and send them out if so.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47620?ContentTypeID=1</link><pubDate>Tue, 29 Mar 2016 14:01:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:feb8b42c-57bd-4ec1-9896-4dbfb4eeaa18</guid><dc:creator>erltot</dc:creator><description>&lt;p&gt;I am using S130 from SDK10 on both peripheral and central, are you saying I will have a better throughput if I switch to S110 and S120?&lt;/p&gt;
&lt;p&gt;And just to clarify; is one 20 byte packet as you write to be considdered a 20 byte string, as I see the dongle split it in the terminal when sending a longer string via the BLE APP UART example?&lt;/p&gt;
&lt;p&gt;I tried to add the flow control fix, I probably made a mistake somewhere, I could recieve the string I tried to send before it crashed. I get error code 7 from ble_nus_string_send. I could not figure out what that mean.&lt;/p&gt;
&lt;p&gt;Code:
&lt;a href="http://pastebin.com/nXEKJXcB"&gt;http://pastebin.com/nXEKJXcB&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I added the function previous known as heart_rate_meas_send to line 101 &amp;quot;uart_send_flowcontrol&amp;quot; and copied the code from the uart event function (this is probably where mistakes were made) and added the function call in on_ble_evt at line 347&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47619?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2016 15:06:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b356d6f1-4b7a-4d4a-9848-9892d69df42c</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;I checked the central code and it uses connection interval min 20ms and max 75ms. It will choose the min value if it can (depends on number of peripherals it is connected to).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47618?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2016 15:02:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0ba15bb-e6c2-48c0-829f-5ba5d4d86e54</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;When I said &amp;quot;flow control&amp;quot; I meant the &amp;quot;wait for TX_COMPLETE event before sending new packets&amp;quot; (that&amp;#39;s why I put it in apostrophes ;)).&lt;/p&gt;
&lt;p&gt;With S130 as central you can receive 3 packets per connection event. Maximum throughput with 7.5ms is 63.4kbps assuming the peripheral side can send the same amount of packets, see &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.sds.v1.0/dita/softdevices/s130/ble_data_throughput/ble_data_throughput.html?cp=2_7_2_0_13"&gt;here&lt;/a&gt;. Which SoftDevice are you using on the peripheral side? If you are using S130 you can only send two packets per connection event. What is your connection interval? You will be able to send the amount of packets if you use low enough connection interval:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;bitrate = nr of packets per connection interval * 20bytes per packet * 8bit per byte / connection interval
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47617?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2016 09:46:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:769ade17-be15-43c3-a6a6-68603af40c23</guid><dc:creator>erltot</dc:creator><description>&lt;p&gt;Are you refering to flow control on the BLE link(nRF51 to nRF51) or the UART link (nRF51 to AVR)?&lt;/p&gt;
&lt;p&gt;I am using another nRF51 dongle as central, perhaps I can adjust some settings on this to achieve higher throughput?
My central is running an edited version of Marco Russis&amp;#39; BLE multilink NUS Central:
&lt;a href="https://github.com/marcorussi/nrf51_multi_nus_central"&gt;github.com/.../nrf51_multi_nus_central&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;My 270 bytes per second from the 54 character string every 200 millis from the peripheral to central seems a long way from the 5 300 bps - 128 000 bps mentioned in the thread you linked to, or am I mission something fundamental about this?
How small is a small package?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47616?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2016 09:32:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:691fa9c7-9b11-4f78-b2d2-3b809a537751</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;The example referred to in the post I linked to is from ble_app_hrs example. But the function &lt;code&gt;ble_hrs_heart_rate_measurement_send(..)&lt;/code&gt; will call &lt;code&gt;sd_ble_gatts_hvx(..)&lt;/code&gt; just as &lt;code&gt;ble_nus_string_send(..)&lt;/code&gt; is doing.&lt;/p&gt;
&lt;p&gt;The UART example will only divide the input over uart in packets of 20 bytes and send it over BLE. If you implement the &amp;quot;flow control&amp;quot; in the link, the example will max the throughput as long as UART bitrate is larger than BLE bitrate.&lt;/p&gt;
&lt;p&gt;If your connection interval is over 200ms and the number of packets you can send per connection event is low (this is for most part limited by the central, take a look at &lt;a href="https://devzone.nordicsemi.com/question/3440/how-do-i-calculate-throughput-for-a-ble-link/"&gt;this post&lt;/a&gt;), you may not be able to get that throughput.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47615?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 19:18:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0f5f8c6-297c-4fee-ad30-0e70caf8b864</guid><dc:creator>erltot</dc:creator><description>&lt;p&gt;I could not completely relate the example you linked to, to the BLE_UART example, could you give an example for this as well?&lt;/p&gt;
&lt;p&gt;I thought the UART example had maximum throughput allready, but it should be alot more than what I am trying to send, which would be around 265 bps (a string of 54 characters every 200 millis)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AVR UART regarding RTS/CTS</title><link>https://devzone.nordicsemi.com/thread/47614?ContentTypeID=1</link><pubDate>Tue, 15 Mar 2016 09:41:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d3af589-4163-4fb0-a857-0478a0eaaaeb</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;The issue is not with the UART, but with the BLE link. You are sending too many packets and the &lt;code&gt;ble_nus_string_send(..)&lt;/code&gt; function is returning &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.api.v2.0.0/group__ble__err.html#ga45302ded90a22c2d2e629ab13531758f"&gt;BLE_ERROR_NO_TX_PACKETS&lt;/a&gt; (error code 0x3004, previously called BLE_ERROR_NO_TX_BUFFERS). The error code originally comes from the &lt;code&gt;sd_ble_gatts_hvx(..)&lt;/code&gt; function which is called inside &lt;code&gt;ble_nus_string_send(..)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;See for example &lt;a href="https://devzone.nordicsemi.com/question/1741/dealing-large-data-packets-through-ble/"&gt;this post&lt;/a&gt; on how to handle this error code and send large amount of data. You should also make sure that the UART buffer (defined in APP_UART_FIFO_INIT) is large enough to buffer the data that are to be sent over BLE.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>