<?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>Data transfer time</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46325/data-transfer-time</link><description>Hi 
 I had this problem. In my program, I send an archive with various data. I send the data using the notification. The central device is a smartphone with Android OS. If you transfer data up to 10 packets, the smartphone normally receives them and displays</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Apr 2019 14:41:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46325/data-transfer-time" /><item><title>RE: Data transfer time</title><link>https://devzone.nordicsemi.com/thread/184118?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 14:41:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f8acbfb-a2fa-4c98-959b-f01219b39867</guid><dc:creator>Filya</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;A little figured out the speed of transmission. I assumed that the number of packets for one interval is set to the maximum possible, but it turned out to be wrong. Inserting this piece of code&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;  // BLE Configuration
  ble_cfg_t ble_cfg;
  // Max Packets Per Connection Event
  memset(&amp;amp;ble_cfg, 0, sizeof ble_cfg);
  ble_cfg.conn_cfg.conn_cfg_tag                            = APP_BLE_CONN_CFG_TAG;
  ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = 6;
  err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &amp;amp;ble_cfg, ram_start);
  APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I increased the transmission speed and was able to reduce the delay to 10 ms. Now the transmission is ~ 760 ms, instead of 1800 ms. Perhaps you can still increase the transmission speed, since I ran into such a parameter as event_length, but I didn&amp;rsquo;t understand how to calculate it correctly for a particular connection interval. At the moment my connection interval is 15 ms.&lt;/p&gt;
&lt;p&gt;Regarding the capabilities of BLE 5, all the same to no avail. The data transfer time is slightly less than that of 4.2 - ~ 720 ms. by reducing the delay to 5 ms., although it should be almost 2 times lower, as I understood from its description.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data transfer time</title><link>https://devzone.nordicsemi.com/thread/183730?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 10:02:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b55a8639-7b67-4633-afd8-d5c9fa915d2d</guid><dc:creator>Filya</dc:creator><description>&lt;p&gt;I also wanted to clarify something.&lt;br /&gt;The total connection time of the peripheral device with the central and data transfer takes about 2800 ms. Separately, the connection takes ~ 850 ms., and data transmission ~ 1800 ms. The rest of the time is spent on data transmission from the central device, that the data is received and the time to disconnect the communication.&lt;br /&gt;From this it turns out that my bandwidth is equal to:&lt;/p&gt;
&lt;p&gt;Throughput = (64*200)/1800 = 7 kB/s.&lt;/p&gt;
&lt;p&gt;Is this the normal speed for transferring from nRF to a phone?&lt;/p&gt;
&lt;p&gt;I also have a phone with BLE v. 5.0. When setting up for transmission in PHY 2M, the result does not change at all, the transmission lasts the same 1800 ms. Also, if you reduce the delay before sending packets, packets will also be lost. Perhaps I am not correctly setting the transfer mode for BLE 5.0?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
  ret_code_t err_code = NRF_SUCCESS;
  
  ble_gap_evt_t const * p_gap_evt = &amp;amp;p_ble_evt-&amp;gt;evt.gap_evt;
  
  switch (p_ble_evt-&amp;gt;header.evt_id)
  {
    ...
    
    case BLE_GAP_EVT_CONNECTED:
    {
      NRF_LOG_INFO(&amp;quot;Handle Client (CON): %x&amp;quot;, hadle_client);
      NRF_LOG_INFO(&amp;quot;Connected.&amp;quot;);
      action_evt = false;
      gap_phy_update(p_gap_evt, BLE_GAP_PHY_2MBPS, BLE_GAP_PHY_2MBPS);// Setting PHY
      min_int = p_ble_evt-&amp;gt;evt.gap_evt.params.connected.conn_params.min_conn_interval;
      max_int = p_ble_evt-&amp;gt;evt.gap_evt.params.connected.conn_params.max_conn_interval;
      NRF_LOG_INFO(&amp;quot;Min int = %d, Max int = %d&amp;quot;, min_int, max_int); 
        
      m_conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
      err_code = nrf_ble_qwr_conn_handle_assign(&amp;amp;m_qwr, m_conn_handle);
      APP_ERROR_CHECK(err_code);
    } break;
    
    ...
    
    case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
    {
      NRF_LOG_DEBUG(&amp;quot;PHY update request.&amp;quot;);
      ble_gap_phys_t const phys =
      {
        .rx_phys = BLE_GAP_PHY_2MBPS,
        .tx_phys = BLE_GAP_PHY_2MBPS,
      };
      err_code = sd_ble_gap_phy_update(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, &amp;amp;phys);
      APP_ERROR_CHECK(err_code);
    } break;
    
    case BLE_GAP_EVT_PHY_UPDATE:
    {
      ble_gap_evt_phy_update_t const * p_phy_evt = &amp;amp;p_ble_evt-&amp;gt;evt.gap_evt.params.phy_update;
      ble_gap_phys_t phys = {0};
      phys.tx_phys = p_phy_evt-&amp;gt;tx_phy;
      phys.rx_phys = p_phy_evt-&amp;gt;rx_phy;
      NRF_LOG_INFO(&amp;quot;PHY set to %s.&amp;quot;, phy_str(phys));
    } break;
    
    ...
    
  }
}


void gap_phy_update(ble_gap_evt_t const * p_gap_evt, uint8_t rx_phy, uint8_t tx_phy)
{
  ble_gap_phys_t const phys =
  {
    .rx_phys = rx_phy,
    .tx_phys = tx_phy,
  };
  uint32_t err_code = sd_ble_gap_phy_update(p_gap_evt-&amp;gt;conn_handle, &amp;amp;phys);
  APP_ERROR_CHECK(err_code);
}

char const * phy_str(ble_gap_phys_t phys)
{
    static char const * str[] =
    {
        &amp;quot;1 Mbps&amp;quot;,
        &amp;quot;2 Mbps&amp;quot;,
        &amp;quot;Coded&amp;quot;,
        &amp;quot;Unknown&amp;quot;
    };

    switch (phys.tx_phys)
    {
        case BLE_GAP_PHY_1MBPS:
            return str[0];

        case BLE_GAP_PHY_2MBPS:
        case BLE_GAP_PHY_2MBPS | BLE_GAP_PHY_1MBPS:
        case BLE_GAP_PHY_2MBPS | BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_CODED:
            return str[1];

        case BLE_GAP_PHY_CODED:
            return str[2];

        default:
            return str[3];
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data transfer time</title><link>https://devzone.nordicsemi.com/thread/183559?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2019 14:53:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7679bcb2-b785-4855-a303-c56a1286f6ab</guid><dc:creator>Filya</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I do not have a sniffer, so I make a log on the phone.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2021.hci_5F00_snoop20190424172643.cfa"&gt;devzone.nordicsemi.com/.../2021.hci_5F00_snoop20190424172643.cfa&lt;/a&gt;&lt;br /&gt;With the help of it, I understood the problem a little. The fact is that during the transfer I lost part of the packages, and if all the packages did not arrive on the phone, he did not send me a flag about the completion of the work. Because of this, it appeared that the program was hanging.&lt;br /&gt;About the data transfer. I have an archive of 12800 bytes. I form 200 byte packets and send them. Sending is done in a while (1) loop in the main program body. If you send packets without delay before each sending, then ~ 95% of packets are lost. To transfer the entire archive (64 packets) I need to set a delay of 25 ms. before sending each package.&lt;br /&gt;If the packet is lost, the sd_ble_gatts_hvx function generates an error NRF_ERROR_RESOURCES. I tried to send packets every time the BLE_GATTS_EVT_HVN_TX_COMPLETE event is executed, but then the delay between sending each packet is 75 ms, which is very much for my purposes.&lt;/p&gt;
&lt;p&gt;Can I somehow increase the transmission speed (that is, reduce the delay that I need to set) or is there a limitation due to the transfer of data to the phone?&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/b/blog/posts/throughput-and-long-range-demo"&gt;Here &lt;/a&gt;it is stated that the transfer for BLE 4.2 is 775 Kbps, but this is in the interaction between the two nRFs.&lt;/p&gt;
&lt;p&gt;I work within BLE 4.2, since it is this version that my phone supports&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks in advance for the answer&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data transfer time</title><link>https://devzone.nordicsemi.com/thread/183464?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2019 12:44:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5e92504-5f10-44cb-aaf5-f71398cb3d57</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Hi.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I guess this will be due to limitations on the phone side.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you please provide a sniffer trace for this?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&amp;nbsp;&lt;br /&gt;Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>