<?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>Extended advertising fails configuration</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85178/extended-advertising-fails-configuration</link><description>For our application, if the device loses connection, we enter beacon mode for longer range, and advertise using extended advertising to broadcast more data. Beacon mode wit normal advertising works very well. When I attempt to configure the extended advertising</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Feb 2022 17:10:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85178/extended-advertising-fails-configuration" /><item><title>RE: Extended advertising fails configuration</title><link>https://devzone.nordicsemi.com/thread/355362?ContentTypeID=1</link><pubDate>Mon, 28 Feb 2022 17:10:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd6eb803-0fc6-4a67-abbf-8201a8fd8b91</guid><dc:creator>Steve93</dc:creator><description>&lt;p&gt;Vidar,&lt;/p&gt;
&lt;p&gt;Thank you. I implemented this as you suggested and it worked immediately.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extended advertising fails configuration</title><link>https://devzone.nordicsemi.com/thread/355332?ContentTypeID=1</link><pubDate>Mon, 28 Feb 2022 15:17:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:474cd95c-bc8e-4dfa-a169-a9eb528f3d59</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The &amp;#39;BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_SCANNABLE_UNDIRECTED&amp;#39; type only allows data in the scan response packet, so you will have to place the encoded data in the scan response like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static ble_gap_adv_data_t m_adv_data =
{
    .adv_data =
    {
        .p_data = NULL,
        .len    = 0
    },
    .scan_rsp_data =
    {
        .p_data = m_enc_advdata,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_EXTENDED_MAX_SUPPORTED

    }
};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1646061431544v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;And then update the encode function in advertising_init to use the .scan_rsp_data buffer instead:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void advertising_init(void)
{
    uint32_t      err_code;
    ble_advdata_t advdata;

    ble_advdata_manuf_data_t manuf_specific_data;

    manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;

#if defined(USE_UICR_FOR_MAJ_MIN_VALUES)
    // If USE_UICR_FOR_MAJ_MIN_VALUES is defined, the major and minor values will be read from the
    // UICR instead of using the default values. The major and minor values obtained from the UICR
    // are encoded into advertising data in big endian order (MSB First).
    // To set the UICR used by this example to a desired value, write to the address 0x10001080
    // using the nrfjprog tool. The command to be used is as follows.
    // nrfjprog --snr &amp;lt;Segger-chip-Serial-Number&amp;gt; --memwr 0x10001080 --val &amp;lt;your major/minor value&amp;gt;
    // For example, for a major value and minor value of 0xabcd and 0x0102 respectively, the
    // the following command should be used.
    // nrfjprog --snr &amp;lt;Segger-chip-Serial-Number&amp;gt; --memwr 0x10001080 --val 0xabcd0102
    uint16_t major_value = ((*(uint32_t *)UICR_ADDRESS) &amp;amp; 0xFFFF0000) &amp;gt;&amp;gt; 16;
    uint16_t minor_value = ((*(uint32_t *)UICR_ADDRESS) &amp;amp; 0x0000FFFF);

    uint8_t index = MAJ_VAL_OFFSET_IN_BEACON_INFO;

    m_beacon_info[index++] = MSB_16(major_value);
    m_beacon_info[index++] = LSB_16(major_value);

    m_beacon_info[index++] = MSB_16(minor_value);
    m_beacon_info[index++] = LSB_16(minor_value);
#endif

    manuf_specific_data.data.p_data = (uint8_t *) m_beacon_info;
    manuf_specific_data.data.size   = APP_BEACON_INFO_LENGTH;

    // Build and set advertising data.
    memset(&amp;amp;advdata, 0, sizeof(advdata));

    advdata.name_type             = BLE_ADVDATA_NO_NAME;
    advdata.p_manuf_specific_data = &amp;amp;manuf_specific_data;

    // Initialize advertising parameters (used when starting advertising).
    memset(&amp;amp;m_adv_params, 0, sizeof(m_adv_params));

    m_adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_SCANNABLE_UNDIRECTED;
    m_adv_params.p_peer_addr     = NULL;    // Undirected advertisement.
    m_adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
    m_adv_params.interval        = NON_CONNECTABLE_ADV_INTERVAL;
    m_adv_params.duration        = 0;       // Never time out.
    m_adv_params.set_id          = 7;
    m_adv_params.primary_phy     = BLE_GAP_PHY_1MBPS;
    m_adv_params.secondary_phy   = BLE_GAP_PHY_2MBPS;

    err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data.scan_rsp_data.p_data, &amp;amp;m_adv_data.scan_rsp_data.len);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data, &amp;amp;m_adv_params);
    APP_ERROR_CHECK(err_code);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Also, you have to remove the &amp;quot;advdata.flags&amp;quot; line as the BT specification does not permit this field in a scan response packet.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    advdata.flags                 = flags;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extended advertising fails configuration</title><link>https://devzone.nordicsemi.com/thread/355118?ContentTypeID=1</link><pubDate>Fri, 25 Feb 2022 22:58:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d95279f3-2062-4a18-b6d3-85fa6d4fb85f</guid><dc:creator>Steve93</dc:creator><description>&lt;p&gt;I&lt;span&gt;I followed the example in the long range demo and it still fails. One notable difference in the code is that it uses&amp;nbsp;BLE_GAP_PHY_CODED for the extended advertising which is only available on the 52840, which I&amp;auml;m not using. The code changes produced the same result for me. The long range demo is located at &lt;/span&gt;&lt;b&gt;&lt;a href="https://github.com/NordicPlayground/nRF52-ble-long-range-demo/blob/master/peripheral_long_range_demo_kit/main.c" rel="noopener noreferrer" target="_blank"&gt;https://github.com/NordicPlayground/nRF52-ble-long-range-demo/blob/master/peripheral_long_range_demo_kit/main.c&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>