<?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 achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43061/how-to-achieve-max-throughput-with-nus-service</link><description>Hi All. 
 I have a project where my peripheral (nRF52832) connects to my central (nRF52840), and then transmits 128 byte packets continuously one after the other. It works ok, but data rate is about 5,000 bytes per second max (40,000 bps). This seems</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Feb 2019 08:24:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43061/how-to-achieve-max-throughput-with-nus-service" /><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/171026?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 08:24:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9cc8f6f-5e1e-4fad-9f7f-0aec3587d8db</guid><dc:creator>Philip</dc:creator><description>&lt;p&gt;Great thanks&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn, ill give that a go.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best Regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Phil&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/171022?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 07:51:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fe204f2-5022-41d0-af1b-d0c3891666fe</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Philip&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Requesting 2Mbps mode once you are in a connection is quite easy.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Just run the following code (copied from line 594 of &lt;a href="https://github.com/NordicPlayground/nrf52-ble-multi-link-multi-role/blob/master/ble_peripheral/main_solution.c"&gt;this file&lt;/a&gt;):&lt;/p&gt;
&lt;p&gt;ble_gap_phys_t phys;&lt;br /&gt; phys.rx_phys = BLE_GAP_PHY_2MBPS;&lt;br /&gt; phys.tx_phys = BLE_GAP_PHY_2MBPS;&lt;br /&gt; err_code = sd_ble_gap_phy_update(m_conn_handle, &amp;amp;phys);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/170820?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 10:17:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb73cb25-92cb-4b0f-9003-6b89c44fe06b</guid><dc:creator>Philip</dc:creator><description>&lt;p&gt;Ok, might try that at some point.&lt;/p&gt;
&lt;p&gt;Is there an example anywhere how to change to 2Mbps?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards&lt;/p&gt;
&lt;p&gt;Phil&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/170812?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 10:05:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3965fd45-caa1-4507-9eba-bc55169dd4a1</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Philip&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Good to hear you figured it out and got better performance!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;With Nordic devices on both sides you could also switch to 2Mbps mode for even higher throughput (or lower average current), but doing so will reduce the maximum range by around 30%.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/170803?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 09:45:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08b19716-585a-4516-be4b-24c6caa26ba2</guid><dc:creator>Philip</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi&amp;nbsp;&lt;/span&gt;&lt;span&gt;Torbj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Yes it is working better now, see above message for latest graph. The packets are 240 bytes. Phy is auto so probably 1Mbps.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I figured out the issue, and set interval to 75 - 100mS, and the event length to 60. It now sends loads of packets in each interval. Maybe before the settings we such that it would only do 1 packet. Changing the settings meant I needed to increase the RAM for softdevice, so it probably has a buffer enabled somewhere.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for your help.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Phil&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/170802?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 09:40:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33f3b268-e83e-4168-962c-6584695157e5</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Philip&lt;/p&gt;
&lt;p&gt;An event length of 6 equals 7.5ms, which should be enough for a couple of packets, but there&amp;nbsp;might be&amp;nbsp;some overhead at the start and end of the event.&lt;/p&gt;
&lt;p&gt;You are sending packets of 240 bytes in length?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Which phy are you using?&lt;/p&gt;
&lt;p&gt;Did you figure out the issue when setting the connection interval to 20 and 30?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/170662?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 14:14:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59fc691e-98cf-40d7-9ee8-6a3a0188060d</guid><dc:creator>Philip</dc:creator><description>&lt;p&gt;Update: Managed to get to 491Kbps which will be good enough for my application. Was able to update the min max connection times to 75 - 100, and the&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp;to 60. This seems to push a lot more packets through in each time slot.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I think maybe with&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp; = 6, the softdevice just did one packet per connection interval.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/491kbps.png" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/170610?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 12:21:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c785f5b-af06-4918-b37b-a71a17facaf1</guid><dc:creator>Philip</dc:creator><description>&lt;p&gt;Also, my central min a max connection interval is 7.5 and 10. My peripheral is 7.5 and 100.&lt;/p&gt;
&lt;p&gt;If I change my central intervals to 20 and 30 for example, no messages are sent.&lt;/p&gt;
&lt;p&gt;Seems like the setup I have can not be adjusted at all without it not working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/170529?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 09:01:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e097a57f-865f-4409-9695-dd6e14472e06</guid><dc:creator>Philip</dc:creator><description>&lt;p&gt;Hi, yes here is my send_data function, and also where it is called;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void send_data(void)
{
    uint8_t swimData[244];

    uint8_t test_counter = 0;

    ret_code_t err_code;

    //TODO - Add something here so if it fails X number of times, we stop download and disconnect 
    uint16_t length = (uint16_t)240;

    err_code = NRF_SUCCESS;

    test_counter = 0;

    while (err_code == NRF_SUCCESS &amp;amp; page_count != 0)
    {
        //TODO - Commented the read out to get throughput result without the delay of this.
        //Read_Data(240, P0, P1, P2, swimData); //start writing at byte 1 rather than 0. This means there are 5 bytes we can overwrite

        swimData[0] = test_counter;
        swimData[1] = P1;
        swimData[2] = P2;  //test_counter to see how many times this loops before failing

        //Have to send this so central knows when it has received the last packet of data i.e. page_count gets to zero
        swimData[3] = GET_HI_CHAR(page_count);
        swimData[4] = GET_LO_CHAR(page_count);

test_counter++;
        err_code = ble_nus_data_send(&amp;amp;m_nus, swimData, &amp;amp;length, m_conn_handle);
        
        if(err_code == NRF_SUCCESS)
        {
          nrf_gpio_pin_toggle(TEST_PIN); //TODO - Test toggle this when sending so we can monitor with scope

          P1++;
          if(P1 == 0) P2++;
          page_count--;
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And called from;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        case BLE_NUS_EVT_TX_RDY:
            //Try sending data here

            if(downloading == true &amp;amp; page_count != 0)
            {
                send_data();
            }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I thought maybe&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH (which is 6) is not big enough to get another packet in the 10mS slot, so am trying to increase that also / experiment.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Phil&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/170526?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 08:55:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a526f70d-5370-41de-a936-0720cc3c6cd1</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Philip&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You should definitely be able to get more than one packet pr connection interval.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you make sure to call ble_nus_data_send(..) in a loop&amp;nbsp;(until it returns an error) every time the&amp;nbsp;&lt;span&gt;BLE_NUS_EVT_TX_RDY&amp;nbsp;event occurs?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Maybe you can share the code you implemented for doing this?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;br /&gt;Torbjørn&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/170406?ContentTypeID=1</link><pubDate>Mon, 11 Feb 2019 14:31:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7edbcf42-ce47-4f64-a690-8a4a7a2ebc8f</guid><dc:creator>Philip</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi&amp;nbsp;&lt;/span&gt;&lt;span&gt;Torbj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I added a pin toggle when ever&amp;nbsp;ble_nus_data_send happens, and monitored it on a scope. I send 64 packets of 240 bytes. It takes about 10mS per message, so it is only fitting one in each connection interval at the moment. Surely it should be able to get more than 1 packet into each 10mS interval?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/packets.png" /&gt;Phil&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/170223?ContentTypeID=1</link><pubDate>Sat, 09 Feb 2019 17:53:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11d7028f-3bba-43e9-9c16-b670d6ee1888</guid><dc:creator>Philip</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;The guide didn&amp;#39;t help much. After tinkering with config settings I&amp;#39;m still getting about 80kbps now max, is that close to the best possible throughput between two nRF52 devices?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Phil&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/168634?ContentTypeID=1</link><pubDate>Wed, 30 Jan 2019 09:13:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9bfb840-2281-4af7-8467-c9da9552fd96</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Philip&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I should probably have asked you about that. That is the right way to maximize throughput, by uploading data continuously until the error is returned. Once the ready event occurs you can then repeat the procedure, and once again upload as many packets as you can.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/168555?ContentTypeID=1</link><pubDate>Tue, 29 Jan 2019 18:14:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:201e1cea-3482-4487-a619-a1dc33a6cbc2</guid><dc:creator>Philip</dc:creator><description>&lt;p&gt;Thanks&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn, I will take a look at that guide.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I managed to boost the speed a fair bit by calling &amp;quot;ble_nus_data_send&amp;quot; in a while loop until its response&amp;nbsp;doesn&amp;#39;t equal NRF_SUCCESS rather than just once in the&amp;nbsp;BLE_NUS_EVT_TX_RDY event.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Ill try some other tweeks once I have read the guide.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Phil&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to achieve max throughput with NUS service?</title><link>https://devzone.nordicsemi.com/thread/168390?ContentTypeID=1</link><pubDate>Tue, 29 Jan 2019 08:23:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e71eee7-382c-469c-b580-1d1251bf1bcd</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Phil&lt;/p&gt;
&lt;p&gt;The SoftDevice team wrote a nice guide on how to set connection parameters and stack configuration properly for good throughput, and I would suggest reading through that first.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The guide is available &lt;a href="https://www.nordicsemi.com/DocLib/Content/SoftDevice_Spec/s140/latest/SDS/s1xx/multilink_scheduling/suggested_intervals_windows_s132"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If something is still unclear after reading through it just let me know, and I will do my best to help &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>