<?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>Notification frequency</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18864/notification-frequency</link><description>Hi 
 I&amp;#39;m using nrf51 to notify some data to an andriod device. I set the connection interval of my nrf51 program to 7.5ms. And I need to send 100 packets per second (20 bytes per packet). However, sometimes there are packets loss and I cannot receive</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 09 Jan 2017 14:12:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18864/notification-frequency" /><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72870?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 14:12:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d555c97e-1a8e-43ad-a5fb-beb3c902acb0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Eric,&lt;/p&gt;
&lt;p&gt;There is no such term as &amp;quot;packet loss&amp;quot; with BLE. Packet if not ACKed will be re-transmitted until it&amp;#39;s ACKed or the connection will time out.&lt;/p&gt;
&lt;p&gt;What you described as packet loss here could be that the call to sd_ble_gatts_hvx() wasn&amp;#39;t successful. Meaning the packet is not queued to be sent. You should always check for the return code of any API call. For example if the TX buffer is full you will receive BLE_ERROR_NO_TX_PACKETS and you will have to recall the hvx api again later (you can wait till TX_COMPLETE return to retransmit)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72871?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 13:39:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd0d722a-1082-4fc7-8619-270921d446b9</guid><dc:creator>ericzhao</dc:creator><description>&lt;p&gt;Yes. I was considering about the connection interval problem on android when I posted this question. Actually I&amp;#39;m developing a private android application and a ble application on nrf51. In current stage, the client didn&amp;#39;t require a public application but the problem should be considered if they want it to be public in the future. Thank you wojtek! You helped me a lot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72869?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 13:15:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48b1ac3b-a60a-484a-ab8a-1c3c80c39c57</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;Oh, just one more thought: if you are trying connection with android device, it is highly propable that you dont have 7.5ms connection interval! many smartphones dont accept that. However, they often allow more than one packet/connection interval. But you should not depend on that if you are developing public app, because it is not standarized between phones and some accept long connection interval and ex. only 2 packets/connection, and some allow shorter interval and for example 4 packets/connection. So, achieving high throughput between bluetooth smart device and smartphone could be quite problematic. as far as i know (i am not really into mobile development...) it also depends of android version installed - in 7.0 shorter connection intervals could be rejected.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72868?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 12:19:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ee93fa8-88f4-4e76-afd1-102b5012b20d</guid><dc:creator>ericzhao</dc:creator><description>&lt;p&gt;OK. I will do more test on it. Thank you a lot Wojtek!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72867?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 12:14:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ab82e0f-7015-4ecd-8a95-5d91c4ff6411</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;It should be easily achievable if your receiver is in good range. It is possible to send 133 notifications (assuming one packet per connection interval, 7.5ms interval), so even when there are some retransmissions, 100 packets should be send.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72866?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 12:12:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ba0e00c-fdba-4085-a968-f4f0efc03c54</guid><dc:creator>ericzhao</dc:creator><description>&lt;p&gt;I checked the error code and it&amp;#39;s the tx buffer problem as you said. Thanks a lot!&lt;/p&gt;
&lt;p&gt;I solved the problem by this way: resent the packet if error code is returned until NRF_SUCCESS is returned. But in this way, 100 packets per second may not be able to achieve when there are tx buffer problems in 1 second. Is there any better solution to send 100 packets per second?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72864?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 11:32:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5477b5d-bf68-49d1-aa50-0f54beb2e052</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;If transmission is not succesfull (not acked by the peer), transmission buffer may not be emptied, so adding another packets is probably not successful. buffering the data and trying to send it just a bit later should do the work :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72863?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 11:30:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcff4c4c-0b79-4550-af71-cdfb476d1bea</guid><dc:creator>ericzhao</dc:creator><description>&lt;p&gt;1-5 packets loss sometimes. not always receive 100 packets. I will try to check the return value. Thank you a lot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72865?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 11:26:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5850d798-0c07-4c4f-bdb9-29ef26ba4956</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;Ok, so i see you are not checking sd_ble_gatts_gvx returned value. Check it and if it is not success, you should wait more time to send the notification. Also, how many packets you loose?  I did succesfully manage to send about 133x20byte packets/second when using 7.5ms interval.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72862?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 11:20:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f56b47b8-bc04-4234-a8e6-e18293aed447</guid><dc:creator>ericzhao</dc:creator><description>&lt;p&gt;hi wojtek&lt;/p&gt;
&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;This is the part of sending notification. I use a timer to control the time. In one second, the nrf51 reads the sensor 100 times and everytime it finished the reading, ble_mpu_update is used to notify the data. accel_values_t is a 20 bytes struct.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void ble_mpu_update(ble_mpu_t *p_mpu, accel_values_t * accel_values)
{
    // Send value if connected and notifying
    if (p_mpu-&amp;gt;conn_handle != BLE_CONN_HANDLE_INVALID)
    {
        uint16_t               len = sizeof(accel_values_t);
        ble_gatts_hvx_params_t hvx_params;
        memset(&amp;amp;hvx_params, 0, sizeof(hvx_params));

        hvx_params.handle = p_mpu-&amp;gt;accel_char_handles.value_handle;
        hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;
        hvx_params.offset = 0;
        hvx_params.p_len  = &amp;amp;len;
        hvx_params.p_data = (uint8_t*)accel_values;  

        sd_ble_gatts_hvx(p_mpu-&amp;gt;conn_handle, &amp;amp;hvx_params);
    } 
    
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Notification frequency</title><link>https://devzone.nordicsemi.com/thread/72872?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 11:13:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf7bf37a-d915-4837-881a-8b049ad82fee</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;show code - it all depends how you send notifications. If you are pushing them even if there are no more tx buffers available, you will loose some of them. you have to wait till all buffers are emptied. there are plenty of topics here on devzone describing how to get high throughput - you should familiarize yourself with them&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>