<?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>NRF52 data loss tx power</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101832/nrf52-data-loss-tx-power</link><description>Hello, 
 i&amp;#39;m currently using an nrf52811 board with the s112 ble stack. i&amp;#39;m currently facing a data loss issues. i&amp;#39;m sending 20 byte payloads with 250 Hz. Everything works fine in a very low distance to my computer. but as i move a little i experience</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Jul 2023 08:56:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101832/nrf52-data-loss-tx-power" /><item><title>RE: NRF52 data loss tx power</title><link>https://devzone.nordicsemi.com/thread/436420?ContentTypeID=1</link><pubDate>Fri, 14 Jul 2023 08:56:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0aa683a6-bdd3-425c-b3de-cc8d81f616b0</guid><dc:creator>rsf</dc:creator><description>&lt;p&gt;Alright i&amp;#39;ll try to get the required hardware for the sniffer to provide a sniffer trace.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 data loss tx power</title><link>https://devzone.nordicsemi.com/thread/436409?ContentTypeID=1</link><pubDate>Fri, 14 Jul 2023 08:36:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e43fea90-5a2e-408d-9111-9a7798931893</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;You can improve the throughput in various way. What we need to see is to have a &lt;a href="https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le"&gt;sniffer trace.&amp;nbsp;&lt;br /&gt;&lt;/a&gt;For example: reduce connection interval, increase data length and send more data in one packet.&lt;/p&gt;
&lt;p&gt;Maximum data throughput you can have with a 1Mbps connection is up to about 600-700kbps.&amp;nbsp; See here:&amp;nbsp;&lt;a href="https://www.youtube.com/watch?v=K1ItqEZ2_tw&amp;amp;ab_channel=NordicSemiconductor"&gt;https://www.youtube.com/watch?v=K1ItqEZ2_tw&amp;amp;ab_channel=NordicSemiconductor&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 data loss tx power</title><link>https://devzone.nordicsemi.com/thread/436407?ContentTypeID=1</link><pubDate>Fri, 14 Jul 2023 08:33:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc890579-6743-49eb-818a-a1fa0a76f1be</guid><dc:creator>rsf</dc:creator><description>&lt;p&gt;i think that&amp;#39;s pretty unmodified from an example (i think this one &lt;a id="" href="https://github.com/bjornspockeli/custom_ble_service_example/blob/master/Readme.md"&gt;https://github.com/bjornspockeli/custom_ble_service_example/blob/master/Readme.md&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t ble_cus_custom_value_update(ble_cus_t * p_cus, uint8_t* custom_value, uint16_t length)
{
    if (p_cus == NULL)
    {
        return NRF_ERROR_NULL;
    }

    uint32_t err_code = NRF_SUCCESS;
    ble_gatts_value_t gatts_value;

    // Initialize value struct.
    memset(&amp;amp;gatts_value, 0, sizeof(gatts_value));

    gatts_value.len     = sizeof(uint8_t) * length;
    gatts_value.offset  = 0;
    gatts_value.p_value = custom_value;

    // Update database.
    err_code = sd_ble_gatts_value_set(p_cus-&amp;gt;conn_handle,
                                      p_cus-&amp;gt;custom_value_handles.value_handle,
                                      &amp;amp;gatts_value);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }

    // Send value if connected and notifying.
    if (p_cus-&amp;gt;conn_handle != BLE_CONN_HANDLE_INVALID)
    {
        ble_gatts_hvx_params_t hvx_params;

        memset(&amp;amp;hvx_params, 0, sizeof(hvx_params));

        hvx_params.handle = p_cus-&amp;gt;custom_value_handles.value_handle;
        hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;
        hvx_params.offset = gatts_value.offset;
        hvx_params.p_len  = &amp;amp;gatts_value.len;
        hvx_params.p_data = gatts_value.p_value;

        err_code = sd_ble_gatts_hvx(p_cus-&amp;gt;conn_handle, &amp;amp;hvx_params);
        NRF_LOG_INFO(&amp;quot;sd_ble_gatts_hvx result: %x. \r\n&amp;quot;, err_code);
    }
    else
    {
        err_code = NRF_ERROR_INVALID_STATE;
        NRF_LOG_INFO(&amp;quot;sd_ble_gatts_hvx result: NRF_ERROR_INVALID_STATE. \r\n&amp;quot;);
    }


    return err_code;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;If you touch the housing or move the device further away, there are more chance that the packet is not received by the peer and when that happen BLE will try to resend the packet causing the buffer not to be cleared and you have more chance of buffer overflow.&amp;nbsp;&amp;quot; - ah ok didn&amp;#39;t know that, thanks for the info&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;best,&lt;br /&gt;martin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 data loss tx power</title><link>https://devzone.nordicsemi.com/thread/436402?ContentTypeID=1</link><pubDate>Fri, 14 Jul 2023 08:25:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:006e69f5-6673-46f0-ae51-93dc22d6d5bc</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Martin,&amp;nbsp;&lt;br /&gt;Yes correct&amp;nbsp;&lt;span&gt;sd_ble_gap_tx_power_set() can be used to change the TX Power.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you touch the housing or move the device further away, there are more chance that the packet is not received by the peer and when that happen BLE will try to resend the packet causing the buffer not to be cleared and you have more chance of buffer overflow.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please show us how you send data inside&amp;nbsp;ble_cus_custom_value_update()&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 data loss tx power</title><link>https://devzone.nordicsemi.com/thread/436383?ContentTypeID=1</link><pubDate>Fri, 14 Jul 2023 05:53:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4841088c-054b-4ffb-835f-d1ec13f8aaa5</guid><dc:creator>rsf</dc:creator><description>&lt;p&gt;yes i know that 2Mbps reduces the range. I&amp;#39;ll check if we can change that. we&amp;#39;ve set it to 2Mbps because we have a datarate of 5kB/s to 9kB/s.&lt;/p&gt;
&lt;p&gt;i&amp;#39;m not sure if the buffer oferflows, i&amp;#39;d estimate that this happens kind of regularly or with some pattern. it looks like the dataloss issues appear if we move the device away from the pc or touch the housing or similar; but they don&amp;#39;t appear if we leave the pcb on the desk and measure (we&amp;#39;ve tested up to 30 minutes).&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll check if we can use 1 MBps and if we can queue the package in again for certain error codes. and i try to install and run the ble sniffer to get more insights about the bluetooth packages.&lt;/p&gt;
&lt;p&gt;but i&amp;#39;d still have the question about the tx power and how to apply it properly. do i change the radio power by setting sd_ble_gap_tx_power_set?&lt;/p&gt;
&lt;p&gt;best,&lt;br /&gt;martin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 data loss tx power</title><link>https://devzone.nordicsemi.com/thread/436267?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2023 13:05:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a8db09e-2510-415d-bc45-6c097f64d9bf</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Martin,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Using 2Mbps improve throughput but reduce the range. You may want to consider using 1Mbps&amp;nbsp;to see if you have better range.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My assumption is that inside&amp;nbsp;&amp;nbsp;&lt;span&gt;ble_cus_custom_value_update() you queue your data in the notification / write command buffer and if the buffer is full, you will receive an error and skip the package ?&amp;nbsp;&lt;br /&gt;In stead you should try to queue the package again when there is more available buffer to queue.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1689253384200v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It&amp;#39;s normal for the buffer to be full. If you queue too many package when the connection doesn&amp;#39;t support high throughput ( for example&amp;nbsp;when connection interval is high). I would suggest to use&lt;a href="https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le"&gt; the sniffer to capture a trace&lt;/a&gt;, this will show what&amp;#39;s the bottle neck.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 data loss tx power</title><link>https://devzone.nordicsemi.com/thread/436243?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2023 12:06:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04681cfb-a899-4742-8d03-a0b07d6f8631</guid><dc:creator>rsf</dc:creator><description>&lt;p&gt;hello,&lt;/p&gt;
&lt;p&gt;we&amp;#39;ve started with a bluteooth template and added our custom services etc.&lt;/p&gt;
&lt;p&gt;our payload consists of some data and a counter. we use the counter to check if and how many payloads were lost. we stream this data to the pc where can logg data. if we inspect the data we see that somtimes payloads are missing (the validation indicator drops from 1 to 0 if we&amp;#39;ve detected counter jumps).&lt;/p&gt;
&lt;p&gt;&lt;a href="https://ibb.co/0sHc8Rb"&gt;https://ibb.co/0sHc8Rb&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;we&amp;#39;ve used this function from an example&lt;/p&gt;
&lt;p&gt;uint32_t ble_cus_custom_value_update(ble_cus_t * p_cus, uint8_t* custom_value, uint16_t length)&lt;/p&gt;
&lt;p&gt;sometimes this function returned an error code and the transmission was terminated. we didn&amp;#39;t terminate on purpose. we just accept the data loss and continue with the next dataset. i don&amp;#39;t know if that&amp;#39;s alright.&lt;/p&gt;
&lt;p&gt;right now i&amp;#39;m trying to figure out if the issue is originated due to a hw, fw or sw issue.&lt;/p&gt;
&lt;p&gt;we didn&amp;#39;t send anything for review. we&amp;#39;ve used a breakoutboard (Fanstel BM833A) board for our design. do we have to tune that additionally?&lt;/p&gt;
&lt;p&gt;currently we&amp;#39;ve set 2mbps for BLEPHY. power consumtion is important but not the most important parameter for our device since it&amp;#39;s mostly just used for a couple of hours.&lt;/p&gt;
&lt;p&gt;i&amp;#39;ve added these lines.&lt;br /&gt;err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_advertising.adv_handle , RADIO_TXPOWER_TXPOWER_Pos4dBm);&lt;br /&gt;&amp;nbsp; if(err_code != NRF_SUCCESS)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return err_code;&lt;/p&gt;
&lt;p&gt;does the tx power affect the transmission stability?&lt;/p&gt;
&lt;p&gt;best,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 data loss tx power</title><link>https://devzone.nordicsemi.com/thread/436222?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2023 11:28:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6fce86b-d9d2-47de-a9aa-3e61a492a5dc</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Martin,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you explain a little bit more about data loss issue ? How do you measure it ?&amp;nbsp;&lt;br /&gt;Bluetooth will re-transmit a packet if it doesn&amp;#39;t receive an ACK. So theoretically there is no data loss in BLE, otherwise the connection will be terminated.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try to test with a Dev Kit as a reference to see the distance you can achieve ?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;There could be a chance that the radio part of your board has not been tuned. Have you sent your design to us for review ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;In theory, the range can be increased by switching to CODED PHY instead of 1Mbps. But the draw back is that the power consumption will be higher. And more chance for interference due to longer on air package.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>