<?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>Unable to convert to Long Range after looking at umpteen examples :-(</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40476/unable-to-convert-to-long-range-after-looking-at-umpteen-examples--</link><description>Using SDK 15.2, PCA10056 Dev Kit. Segger Embedded Studio. s140_nrf52_6.1.0_softdevice.hex 
 Our Code (non Long Range) works perfectly! We are using it in a test for a customer. The code is based on the UART example. However, we want more range, and want</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Mar 2021 07:20:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40476/unable-to-convert-to-long-range-after-looking-at-umpteen-examples--" /><item><title>RE: Unable to convert to Long Range after looking at umpteen examples :-(</title><link>https://devzone.nordicsemi.com/thread/302052?ContentTypeID=1</link><pubDate>Fri, 26 Mar 2021 07:20:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9f838ea-cb2a-4ae4-9b42-b0cba89a5919</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can see modifications I made for these 2 example in the &amp;#39;diff&amp;#39; file below. It should not be much different in SDK 17.0.2&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="diff"&gt;diff --git a/examples/ble_central/ble_app_uart_c/main.c b/examples/ble_central/ble_app_uart_c/main.c
index 5c6ffd5..c53297b 100644
--- a/examples/ble_central/ble_app_uart_c/main.c
+++ b/examples/ble_central/ble_app_uart_c/main.c
@@ -116,6 +116,10 @@ static void scan_start(void)
 
     ret = bsp_indication_set(BSP_INDICATE_SCANNING);
     APP_ERROR_CHECK(ret);
+
+    //Optional: Change output power
+    ret = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_SCAN_INIT, 0, 8);
+    APP_ERROR_CHECK(ret);
 }
 
 
@@ -164,13 +168,25 @@ static void scan_evt_handler(scan_evt_t const * p_scan_evt)
  */
 static void scan_init(void)
 {
-    ret_code_t          err_code;
-    nrf_ble_scan_init_t init_scan;
+    ret_code_t            err_code;
+    nrf_ble_scan_init_t   init_scan;
+    ble_gap_scan_params_t scan_params;
+
+    memset(&amp;amp;scan_params, 0, sizeof(ble_gap_scan_params_t));
+
+    scan_params.active        = 1;
+    scan_params.interval      = NRF_BLE_SCAN_SCAN_INTERVAL;
+    scan_params.window        = NRF_BLE_SCAN_SCAN_WINDOW;
+    scan_params.timeout       = NRF_BLE_SCAN_SCAN_DURATION;
+    scan_params.filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL;
+    scan_params.scan_phys     = BLE_GAP_PHY_CODED;
+    scan_params.extended      = true;
 
     memset(&amp;amp;init_scan, 0, sizeof(init_scan));
 
     init_scan.connect_if_match = true;
     init_scan.conn_cfg_tag     = APP_BLE_CONN_CFG_TAG;
+    init_scan.p_scan_param     = &amp;amp;scan_params;
 
     err_code = nrf_ble_scan_init(&amp;amp;m_scan, &amp;amp;init_scan, scan_evt_handler);
     APP_ERROR_CHECK(err_code);
diff --git a/examples/ble_central/ble_app_uart_c/pca10056/s140/config/sdk_config.h b/examples/ble_central/ble_app_uart_c/pca10056/s140/config/sdk_config.h
index bb9c621..8ff8018 100644
--- a/examples/ble_central/ble_app_uart_c/pca10056/s140/config/sdk_config.h
+++ b/examples/ble_central/ble_app_uart_c/pca10056/s140/config/sdk_config.h
@@ -127,7 +127,7 @@
 #endif
 // &amp;lt;o&amp;gt; NRF_BLE_SCAN_BUFFER - Data length for an advertising set. 
 #ifndef NRF_BLE_SCAN_BUFFER
-#define NRF_BLE_SCAN_BUFFER 31
+#define NRF_BLE_SCAN_BUFFER 255
 #endif
 
 // &amp;lt;o&amp;gt; NRF_BLE_SCAN_NAME_MAX_LEN - Maximum size for the name to search in the advertisement report. 
@@ -184,7 +184,7 @@
 // &amp;lt;255=&amp;gt; BLE_GAP_PHY_NOT_SET 
 
 #ifndef NRF_BLE_SCAN_SCAN_PHY
-#define NRF_BLE_SCAN_SCAN_PHY 1
+#define NRF_BLE_SCAN_SCAN_PHY 4
 #endif
 
 // &amp;lt;e&amp;gt; NRF_BLE_SCAN_FILTER_ENABLE - Enabling filters for the Scanning Module.
@@ -12394,7 +12394,7 @@
 // &amp;lt;i&amp;gt; Requested BLE GAP data length to be negotiated.
 
 #ifndef NRF_SDH_BLE_GAP_DATA_LENGTH
-#define NRF_SDH_BLE_GAP_DATA_LENGTH 251
+#define NRF_SDH_BLE_GAP_DATA_LENGTH 27
 #endif
 
 // &amp;lt;o&amp;gt; NRF_SDH_BLE_PERIPHERAL_LINK_COUNT - Maximum number of peripheral links. 
@@ -12423,7 +12423,7 @@
 
 // &amp;lt;o&amp;gt; NRF_SDH_BLE_GATT_MAX_MTU_SIZE - Static maximum MTU size. 
 #ifndef NRF_SDH_BLE_GATT_MAX_MTU_SIZE
-#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247
+#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 23
 #endif
 
 // &amp;lt;o&amp;gt; NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE - Attribute Table size in bytes. The size must be a multiple of 4. 
diff --git a/examples/ble_peripheral/ble_app_uart/main.c b/examples/ble_peripheral/ble_app_uart/main.c
index 4d40d21..a42a8c7 100644
--- a/examples/ble_peripheral/ble_app_uart/main.c
+++ b/examples/ble_peripheral/ble_app_uart/main.c
@@ -616,12 +616,15 @@ static void advertising_init(void)
     init.advdata.include_appearance = false;
     init.advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
 
-    init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
-    init.srdata.uuids_complete.p_uuids  = m_adv_uuids;
-
-    init.config.ble_adv_fast_enabled  = true;
-    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
-    init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;
+    init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
+    init.advdata.uuids_complete.p_uuids  = m_adv_uuids;
+
+    init.config.ble_adv_fast_enabled      = true;
+    init.config.ble_adv_fast_interval     = APP_ADV_INTERVAL;
+    init.config.ble_adv_fast_timeout      = APP_ADV_DURATION;
+    init.config.ble_adv_primary_phy       = BLE_GAP_PHY_CODED;
+    init.config.ble_adv_secondary_phy     = BLE_GAP_PHY_CODED;
+    init.config.ble_adv_extended_enabled  = true;
     init.evt_handler = on_adv_evt;
 
     err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
@@ -687,6 +690,10 @@ static void advertising_start(void)
 {
     uint32_t err_code = ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);
     APP_ERROR_CHECK(err_code);
+
+    //Optional: Change output power
+    err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_advertising.adv_handle, 8);
+    APP_ERROR_CHECK(err_code);
 }
 
 
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to convert to Long Range after looking at umpteen examples :-(</title><link>https://devzone.nordicsemi.com/thread/302048?ContentTypeID=1</link><pubDate>Fri, 26 Mar 2021 06:47:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bff1fd55-dcbb-4018-badb-d8b4ed7c2f2f</guid><dc:creator>amey3</dc:creator><description>&lt;p&gt;&amp;nbsp; Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; How to do&amp;nbsp; these library&amp;nbsp;&amp;nbsp;&lt;span&gt;nRF5_SDK_15.2.0_mod.zip&amp;nbsp; make compatible with nrf5_SDK_17.2.0.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to convert to Long Range after looking at umpteen examples :-(</title><link>https://devzone.nordicsemi.com/thread/157489?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 12:21:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:958e9abf-4f08-4824-b122-22045b6dd40d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thanks for confirming that it worked. Limited discovery mode limits the maximum advertising duration to 180 seconds (BT spec. requirement) and the softdevice enforces this. So if you require a longer or no timeout at all for advertising you need to use the general discovery mode.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Appreciate that you want to share your findings with other users. Unfortunately, the blog post section on this forum is currently limited to nordic employees. You can always create a new forum thread. It should get good visibility for those who are searching for similar subjects.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to convert to Long Range after looking at umpteen examples :-(</title><link>https://devzone.nordicsemi.com/thread/157431?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 09:06:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5bf580a-ff17-4d70-9993-93e52d9b7625</guid><dc:creator>gos</dc:creator><description>&lt;p&gt;Above, I forgot to say that I am using &amp;quot;SEC_JUST_WORKS&amp;quot; in my Service.&lt;/p&gt;
&lt;p&gt;idle_state_handle() also contains the call:&lt;/p&gt;
&lt;p&gt;ret_code_t err_code = nrf_ble_lesc_request_handler();&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to convert to Long Range after looking at umpteen examples :-(</title><link>https://devzone.nordicsemi.com/thread/157426?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 08:53:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:264de065-d09f-41bd-844f-68741edf622c</guid><dc:creator>gos</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;/p&gt;
&lt;p&gt;Your Code compiles and runs with LR (Long Range) for me as well. However, with your LR advertising_init() function in my Peripheral, I still got Error 7 from&amp;nbsp;ble_advertising_start().&lt;/p&gt;
&lt;p&gt;The problem turned out to be this code in the LR advertising_init():&lt;/p&gt;
&lt;p&gt;init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;&lt;/p&gt;
&lt;p&gt;I changed it to the flag that I used in my original (non LR)&amp;nbsp;advertising_init():&lt;/p&gt;
&lt;p&gt;init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;&lt;/p&gt;
&lt;p&gt;and voila, the Error 7 went away: AND the LONG RANGE&amp;nbsp;CODE CONNECTS &amp;amp;&amp;nbsp;WORKS!&lt;/p&gt;
&lt;p&gt;Range does indeed seems to be&amp;nbsp;approx 3 times what I had before,&amp;nbsp;even though the Path Loss today probably is high due to very high humidity (drizzle).&lt;/p&gt;
&lt;p&gt;Goes to show how critical some of this code may be, and thus hard to understand &amp;amp; get working at least for a Novice like me...&lt;/p&gt;
&lt;p&gt;THANKS A LOT FOR YOUR HELP!&lt;/p&gt;
&lt;p&gt;------&lt;/p&gt;
&lt;p&gt;By the way: How do I post Tips to other users?&lt;/p&gt;
&lt;p&gt;I have found easier ways to measure current on the&amp;nbsp;nRF52840 Dev Kit without soldering on the Board.&lt;/p&gt;
&lt;p&gt;I have also found an easier way to&amp;nbsp;Power&amp;nbsp;&amp;amp; Program the nRF52840 Dongle with only one permanent modification.&lt;/p&gt;
&lt;p&gt;(Repeated Soldering on the boards are bound to destroy them as paths will come loose. It is also very time consuming and slows down prototyping)&lt;/p&gt;
&lt;p&gt;I would like to post the tips on how to do this when time permits. But how / where?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to convert to Long Range after looking at umpteen examples :-(</title><link>https://devzone.nordicsemi.com/thread/157306?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 13:27:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dee5bdd-dbfe-48ce-9f60-d6895b0b94b4</guid><dc:creator>gos</dc:creator><description>&lt;p&gt;Thanks a lot Vidar!&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll look at&amp;nbsp;it&amp;nbsp;as soon as possible and report back here !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to convert to Long Range after looking at umpteen examples :-(</title><link>https://devzone.nordicsemi.com/thread/157300?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 13:16:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:056778c1-4eb1-4b4b-9745-5c4a53d25703</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Attached .zip includes the ble_app_uart and ble_app_uart_c example modified to establish the connection in long range mode. Also replaced s140 v.6.1.0 with s140 6.1.1 as it includes some improvements that may reduce packet loss for &amp;quot;coded phy&amp;quot; connections (&lt;a href="https://www.nordicsemi.com/eng/nordic/Products/nRF52840-DK/S140-SD-v6/60625"&gt;https://www.nordicsemi.com/eng/nordic/Products/nRF52840-DK/S140-SD-v6/60625&lt;/a&gt;).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-37b34c342a554e699b4082ad10599ed0/nRF5_5F00_SDK_5F00_15.2.0_5F00_mod.zip"&gt;devzone.nordicsemi.com/.../nRF5_5F00_SDK_5F00_15.2.0_5F00_mod.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>