<?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>gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67801/gap_params_init-and-connection-parameter-issue</link><description>Hello, 
 I&amp;#39;m working on a firmware for a device that is created using ble proximity example. It is power constrain device and required a connection interval of 30 sec between a master (Android phone only) and slave nRF52810. 
 I’m using the following</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Nov 2020 09:19:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67801/gap_params_init-and-connection-parameter-issue" /><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/279649?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 09:19:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95b9bc01-e9df-46fc-a512-c196f7b28e55</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="HaiderRPM"]Error I can see on my nRF Connect app is&amp;nbsp;&lt;strong&gt;Error 133, defined as: &lt;code&gt;#define GATT_ERROR 0x85&lt;/code&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;[/quote]
&lt;p&gt;I see. That is very useful information. Unfortunately GATT error 133 is a quite generic error so it is difficult to say what causes it.&lt;/p&gt;
[quote user="HaiderRPM"]I&amp;#39;m using it with the similar device but does it matter?[/quote]
&lt;p&gt;It would be interesting to know if this only happens with some specific peer devices. Which phones have you tested with (phone model and Android version), and do you see the same behaviour with all?&lt;/p&gt;
[quote user="HaiderRPM"]I also notice it do not connect after disconnection even if I manually tap the connect button on the app. I have to restart my peripheral and connect it.[/quote]
&lt;p&gt;that is interesting. Do you do some debug logging on the nRF side to understand what happens? It would be very useful to see what happens seen form the nRF, bot before the disconnect and which disconnect reason the nRF sees.&lt;/p&gt;
&lt;p&gt;Lastly, a sniffer trace could be very useful, though it may be difficult to produce as the disconnect happens so seldomly. In any case logging and a trace of the failed reconnect attempts before the nRF is reset would also be useful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/279571?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 16:24:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60d368f2-dab2-4320-bc1c-f5e4a134a010</guid><dc:creator>HaiderRPM</dc:creator><description>&lt;p&gt;Hello Einar,&lt;br /&gt;Thank you for your kind response&lt;/p&gt;
&lt;p&gt;Error I can see on my nRF Connect app is&amp;nbsp;&lt;strong&gt;Error 133, defined as: &lt;code&gt;#define GATT_ERROR 0x85&lt;/code&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I believe&amp;nbsp;&lt;span&gt;&lt;strong&gt;supervision timeout&lt;/strong&gt; is not the reason for the disconnection. As last night I changed my connection parameters to the default values accept advertisement interval.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;#define MIN_CONN_INTERVAL MSEC_TO_UNITS(500, UNIT_1_25_MS) /**&amp;lt; Minimum acceptable connection interval (0.5 seconds). */&lt;br /&gt;#define MAX_CONN_INTERVAL MSEC_TO_UNITS(1000, UNIT_1_25_MS) /**&amp;lt; Maximum acceptable connection interval (1 second). */&lt;/p&gt;
&lt;p&gt;#define SLAVE_LATENCY 0 /**&amp;lt; Slave latency. */&lt;br /&gt;#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) /**&amp;lt; Connection supervisory timeout (4 seconds). */&lt;br /&gt; &lt;br /&gt;// change by Haider: old value APP_ADV_INTERVAL 40 {Range can be 20ms to 10.24 sec} /**&amp;lt; The advertising interval (in units of 0.625 ms. This value corresponds to 25 ms). */&lt;br /&gt;#define APP_ADV_INTERVAL MSEC_TO_UNITS(250, UNIT_0_625_MS) &lt;br /&gt;#define APP_ADV_DURATION 30000 // originally: 18000&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using it with the similar device but does it matter? I also notice it do not connect after disconnection even if I manually tap the connect button on the app. I have to restart my peripheral and connect it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/279536?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 15:03:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ddb30e5-10e0-482a-b107-c37f228bd855</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="HaiderRPM"]You mentioned about&lt;strong&gt;&amp;nbsp;Bluetooth specification, Vol6, part B, section 4.5.2: &lt;/strong&gt;in your previous reply, would you please forward me the link for this pdf.[/quote]
&lt;p&gt;You can download the Bluetooth core specification &lt;a href="https://www.bluetooth.com/specifications/bluetooth-core-specification/"&gt;here&lt;/a&gt;.&lt;/p&gt;
[quote user="HaiderRPM"]But it still disconnect after one or two day. [/quote]
&lt;p&gt;What is the disconnect reason? Based on this discussion I assume it is supervision timeout, but I do not see it clearly stated so it would be good to know. Also, have you only tested one Android device, or do you see the same with other devices?&lt;/p&gt;
&lt;p&gt;And also, is there a problem with these disconnects? Normally the peripheral would start advertise on a disconnect and the phone would connect again without the user ever&amp;nbsp;notising a difference.&amp;nbsp;Depending on the RF environment etc it may not be possible to ensure that you never get any disconnects.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/279030?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 13:57:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2441b30d-ea8d-4072-95bf-06d46ce89bd3</guid><dc:creator>HaiderRPM</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I hope you had a great weekend, now I&amp;#39;m following all restrictions you mentioned here. I&amp;#39;m using following new parameters. But it still disconnect after one or two day. I&amp;#39;m using nRF connect app in android (this project is only for android). Can you tell me where I&amp;#39;m going wrong. You mentioned about&lt;strong&gt;&amp;nbsp;Bluetooth specification, Vol6, part B, section 4.5.2: &lt;/strong&gt;in your previous reply, would you please forward me the link for this pdf.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;#define MIN_CONN_INTERVAL MSEC_TO_UNITS(900, UNIT_1_25_MS)&lt;br /&gt;#define MAX_CONN_INTERVAL MSEC_TO_UNITS(1000, UNIT_1_25_MS)&lt;/p&gt;
&lt;p&gt;#define SLAVE_LATENCY 12&amp;nbsp;&lt;br /&gt;#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(32000, UNIT_10_MS)&amp;nbsp;&lt;br /&gt;#define APP_ADV_INTERVAL MSEC_TO_UNITS(250, UNIT_0_625_MS) &lt;br /&gt;#define APP_ADV_DURATION 30000 // originally value was: 18000&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/278371?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2020 08:32:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9684f08f-eabb-43c7-8f4a-de173d5468f2</guid><dc:creator>Edvin</dc:creator><description>[quote user="HaiderRPM"]We have a piezo buzzer (3 mA) and a led (2 mA).&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;In that case, the current from a 4second connection interval is negligible, so you don&amp;#39;t need to spend time trying to increase the connection interval.&lt;/p&gt;
&lt;p&gt;Whether the radio uses 3µA or 1.5µA doesn&amp;#39;t matter when you are drawing 5mA on top of that. Then your current consumption is 5mA, or 5.003mA if you like, but I assume the 5mA is not a 5.000mA.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In your case, the LED is on 1/5th of the time, and the buzzer is on 1/5th of the time, so you have 3/5 + 2/5 mA = 1mA on average.&amp;nbsp;Maybe less if the LED and buzzer are not used simultaneously.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;0.99*3µA&lt;br /&gt;+ 0.005*1000µA&lt;br /&gt;+ 0.005*38µA&lt;/p&gt;
&lt;p&gt;=&amp;nbsp;&lt;br /&gt;2.97µA&lt;br /&gt;+ 5µA&lt;br /&gt;+ 0.19µA&lt;/p&gt;
&lt;p&gt;= 8.16µA on average.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This makes your 110mAh last 13480 hours = 561 days.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Reducing the connection interval to 30 seconds if that was possible would take the average current consumption to 6.865µA, which would last 667 days. It is an increase, but you have a lot more to save by reducing the alarm time (shorter on for the LED and the buzzer).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If that is not an option, I am afraid you need to look into a bigger battery.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/278337?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2020 21:01:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbae3cbf-ddba-4f4c-ba99-9d9283922f09</guid><dc:creator>HaiderRPM</dc:creator><description>&lt;p&gt;We are under the following assumptions.&lt;/p&gt;
&lt;p&gt;We want to use 110 mAh battery but still in the process of finalizing. We have a piezo buzzer (3 mA) and a led (2 mA).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is the alarm sequence&lt;/p&gt;
&lt;p&gt;1- LED &amp;quot;on&amp;quot; 500 ms, &amp;quot;off&amp;quot; 2000 ms&lt;br /&gt;2- LED &amp;quot;on&amp;quot; 500 ms, &amp;quot;off&amp;quot; 2000 ms&lt;br /&gt;4- LED &amp;quot;on&amp;quot; 500 ms, &amp;quot;off&amp;quot; 2000 ms&lt;br /&gt;5- Buzzer &amp;quot;on&amp;quot; 500 ms, &amp;quot;off&amp;quot; 2000 ms - 200 Hz frequency&lt;br /&gt;6- Buzzer &amp;quot;on&amp;quot; 500 ms, &amp;quot;off&amp;quot; 2000 ms&lt;br /&gt;7- Buzzer &amp;quot;on&amp;quot; 500 ms, &amp;quot;off&amp;quot; 2000 ms&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Device will be connected to 99%, 0.5% in alarm state, 0.5% advertising event. Our advertisement interval is 250 ms.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/278198?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2020 08:23:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ee44aeb-0ae3-47e0-a59f-9fbd3c61c5e2</guid><dc:creator>Edvin</dc:creator><description>[quote user="HaiderRPM"]because of our battery life need to be more than 180 days.[/quote]
&lt;p&gt;&amp;nbsp;What battery are you using? That should be doable using a coin cell battery, but it depends on what other things your application is doing. Perhaps you are looking in the wrong place.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If a 15 (or 4 second) connection interval makes your battery drain in less than 180 days, then there is either a bug, or you are using a peripheral that is drawing a lot of power (causing the BLE current consumption to become negligible.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please check out our &lt;a href="https://devzone.nordicsemi.com/nordic/power/w/opp/2/online-power-profiler-for-ble"&gt;Online Power Profiler&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Using 4 sec connection interval, and a bare minimum application it should consume about 3.3µA:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/1184.pastedimage1604391635386v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Edit:&lt;/p&gt;
&lt;p&gt;If the coin cell battery contains 200mAh, it should last a couple of years. Of course there is some loss due to leak current, and your application is maybe using some other peripherals drawing a bit of power. The battery&amp;#39;s internal resistance also matters.&lt;/p&gt;
&lt;p&gt;What sort of battery are you using?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/278137?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2020 15:34:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f1fdbce-cfab-467d-8b18-adb64b8d9b52</guid><dc:creator>HaiderRPM</dc:creator><description>&lt;p&gt;Thank you so much for the your help. We think about your suggestion regarding&amp;nbsp; more power consumption in disconnect and connect method and agree with you and dropping that idea.&lt;/p&gt;
&lt;p&gt;We wanted that spec. because of our battery life need to be more than 180 days. After doing some math we come up with that number. But if its impossible to do, we can compromise over there.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;you mention about&amp;nbsp;&lt;span&gt;Bluetooth specification, Vol6, part B, section 4.5.2:. Do you have link for this PDF. I have a PDF for Apple BLE spec., does something similar exist for Android I looked for it but didn&amp;#39;t find any. It will be a great help if you can give me a link for that.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/278009?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2020 10:09:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48a38938-4c11-4dce-81ab-ffe99ba9da85</guid><dc:creator>Edvin</dc:creator><description>[quote user="HaiderRPM"]But I think (1 + connSlaveLatency) * connInterval * 2 constrain don&amp;#39;t allow to go beyond 15 sec.[/quote]
&lt;p&gt;&amp;nbsp;I agree.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="HaiderRPM"]Do we have a way to disconnection and reconnect the peripheral with the 30 sec interval and transfer&amp;nbsp;packets. but it is important to slave to sleep during that period of time.[/quote]
&lt;p&gt;&amp;nbsp;Yes, it is possible, but I don&amp;#39;t know whether it actually saves you any power. Setting up a connection requires more packets back and forth than just maintaining the &amp;quot;15 second connection interval&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Why do you have this strict requirement of 30ms? Is it to save power? If so, then using 15sec should be fine. You aren&amp;#39;t saving much on going from 15 to 30 seconds. Besides,&amp;nbsp;30 seconds is against the specification.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So why do you have this strict requirement of 30 seconds connection interval?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/277872?ContentTypeID=1</link><pubDate>Fri, 30 Oct 2020 15:41:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a403d6af-0056-42c1-987d-6c2bfca3b9c3</guid><dc:creator>HaiderRPM</dc:creator><description>&lt;p&gt;Thank you for your reply,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I agree with your statement.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can&amp;#39;t have 30ms connection interval. You can have maximum 4 seconds (you can find the limits in ble_gap.h. Search for&amp;nbsp;BLE_GAP_CP_LIMITS).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But my connection interval is 830 ms and I&amp;#39;m taking advantage of slave latency to achieve&amp;nbsp;effective connection interval 30 sec. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But I think (1 + connSlaveLatency) * connInterval * 2 constrain don&amp;#39;t allow to go beyond 15 sec. Or do we have any other way to get the better result.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Do we have a way to disconnection and reconnect the peripheral with the 30 sec interval and transfer&amp;nbsp;packets. but it is important to slave to sleep during that period of time.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gap_params_init and connection parameter issue</title><link>https://devzone.nordicsemi.com/thread/277838?ContentTypeID=1</link><pubDate>Fri, 30 Oct 2020 14:18:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1c49723-4513-4f66-bbc8-7a2fb66ff1b8</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;err_code = 7 means NRF_ERROR_INVALID_PARAM (look at nrf_error.h).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You have set your conn_sup_timeout to 32 000 units of 10ms = 32 seconds, which is the maximum allowed supervision timeout.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;From the Bluetooth specification, Vol6, part B, section 4.5.2:&lt;/p&gt;
&lt;p&gt;The connSupervisionTimeout shall be a multiple of 10ms in the range 100ms to 32.0s and shall be larger than&lt;/p&gt;
&lt;p&gt;(1 + connSlaveLatency) * connInterval * 2&lt;/p&gt;
&lt;p&gt;which is considered in your b. constraint.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When conn_latency = 18:&lt;/p&gt;
&lt;p&gt;(1+18) * 800*1.25 *&amp;nbsp; 2 = 38 000, which is already larger than your supervision timeout, so it should probably have returned NRF_ERROR_INVALID_PARAMS.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can&amp;#39;t have 30ms connection interval. You can have maximum 4 seconds (you can find the limits in ble_gap.h. Search for&amp;nbsp;BLE_GAP_CP_LIMITS).&lt;/p&gt;
&lt;p&gt;The reason that this requirement exists is that the devices should have at least two attempts to send a packet before they disconnect. Otherwise, you will get a disconnect every time a packet is lost due to noise on air.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>