<?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>Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/56017/enabling-2mbps-and-coded-phys</link><description>Hello, I have a project that&amp;#39;s fairly mature and working great but now I want to extend the abilities of the device by using the extended PHYs. I know there are a million threads on this but I can&amp;#39;t make any sense out of any of them. I tried looking at</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Mar 2020 17:16:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/56017/enabling-2mbps-and-coded-phys" /><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/239204?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 17:16:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa6758cc-e217-4a81-a869-5ed140db1e59</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Usman,&lt;/p&gt;
&lt;p&gt;Please try to debug. The debug guide is here:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/#60126"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/238923?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 16:43:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b464354-6c39-407c-a298-7cea38029db5</guid><dc:creator>usman</dc:creator><description>&lt;p&gt;Hi Hung&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tried this advertising code in blinky example. on my device it is not working and I am getting this error&lt;/p&gt;
&lt;p&gt;&amp;uml;&lt;span style="background-color:#ffffff;"&gt;00&amp;gt; &amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;br /&gt;00&amp;gt; &lt;br /&gt;00&amp;gt; &amp;lt;error&amp;gt; app: Fatal error&lt;br /&gt;00&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;&amp;uml;&amp;uml;&lt;/span&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;Led 1 that turn on normally when i am using 1 Mbps is not turning on using above mentioned code.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I shall be very thankful to you if you will help me to sort out this isuue&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Usman&lt;span style="background-color:#ffffff;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/227628?ContentTypeID=1</link><pubDate>Mon, 06 Jan 2020 10:15:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9098de3-3fde-4de1-99b1-32eaa9b58b7a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;You mentioned that you were using blinky example as the base. I assume it&amp;#39;s the ble_app_blinky. The code I posted should work with the ble_app_blinky as the base so you can modify it to your needs.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to have your own service UUID/data in the advertising packet. Just use &lt;span&gt;advdata instead of srdata&lt;/span&gt;:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; advdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);&lt;br /&gt; advdata.uuids_complete.p_uuids = adv_uuids;&lt;/p&gt;
&lt;p&gt;As long as you set&amp;nbsp;&amp;nbsp; &amp;nbsp; m_adv_data.scan_rsp_data.len=0; the code should work with just the .phys and the .type change.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/227475?ContentTypeID=1</link><pubDate>Fri, 03 Jan 2020 16:27:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c364a61-2e81-4145-9b2c-a26282035dbf</guid><dc:creator>Adam Gerken</dc:creator><description>&lt;p&gt;Your code is for the lbs service, I&amp;#39;m not using that. You also didn&amp;#39;t include what you used for the m_adv_data values. It looks like you just changed the .phys and .type which doesn&amp;#39;t work for me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/227474?ContentTypeID=1</link><pubDate>Fri, 03 Jan 2020 16:23:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38874984-cf20-46c6-8b6c-6ba0252e6635</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hmm, not sure why but in my case it didn&amp;#39;t complain. Have you tried my code?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/227443?ContentTypeID=1</link><pubDate>Fri, 03 Jan 2020 14:19:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c098a0c-6d7c-4938-806b-a8d6442985fd</guid><dc:creator>Adam Gerken</dc:creator><description>&lt;p&gt;What does that mean? I thought I set the length to 0 but I still get the error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/227350?ContentTypeID=1</link><pubDate>Fri, 03 Jan 2020 08:48:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1356661a-fdb7-40d5-87cb-e2790e071152</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Just remove the srdata, or set the length to 0, it&amp;#39;s fine. As I mentioned when advertising in coded phy the data is sent via data channel, not the advertising channel so there is no scan response packet. All data can go into the advertising packet.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/227312?ContentTypeID=1</link><pubDate>Thu, 02 Jan 2020 20:48:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b4a57ff-0f75-41f0-a22d-a77ad73a29c5</guid><dc:creator>Adam Gerken</dc:creator><description>&lt;p&gt;Hung, this&amp;nbsp;runs for me if I comment out lines 24 and 25, (53/54 below) but I&amp;#39;m not sure if it&amp;#39;ll actually work... I don&amp;#39;t have a coded phy peer right now. Is it acceptable to remove these lines?&lt;/p&gt;
&lt;p&gt;If I uncomment them I get a DATA_LENGTH error.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Struct that contains pointers to the encoded advertising data. */
static ble_gap_adv_data_t m_adv_data =
{
    .adv_data =
    {
        .p_data = m_enc_advdata,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
    },
    .scan_rsp_data =
    {
        .p_data = m_enc_scan_response_data,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX

    }
};
/**@brief Struct that contains pointers to the encoded advertising data for extended advertising types. */
static ble_gap_adv_data_t m_adv_data_ext =
{
    .adv_data =
    {
        .p_data = m_enc_advdata,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
    },
    .scan_rsp_data =
    {
        .p_data = NULL,//m_enc_scan_response_data,
        .len    = 0//BLE_GAP_ADV_SET_DATA_SIZE_MAX

    }
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void advertising_init(void){

    ret_code_t    err_code;
    ble_advdata_t advdata;
    ble_advdata_t srdata;

    ble_uuid_t adv_uuids[] = {{CTCWS_UUID_CONFIG_SERVICE, m_ctcws.uuid_type}};

    // Build and set advertising data.
    memset(&amp;amp;advdata, 0, sizeof(advdata));

    advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance = true;
    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;


    memset(&amp;amp;srdata, 0, sizeof(srdata));
    srdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
    srdata.uuids_complete.p_uuids  = adv_uuids;

    err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data.adv_data.p_data, &amp;amp;m_adv_data.adv_data.len);
    APP_ERROR_CHECK(err_code);

    if (tx_rate != BLE_GAP_PHY_CODED){  //anything other than coded

        err_code = ble_advdata_encode(&amp;amp;srdata, m_adv_data.scan_rsp_data.p_data, &amp;amp;m_adv_data.scan_rsp_data.len);
        APP_ERROR_CHECK(err_code);

        ble_gap_adv_params_t adv_params;

        // Set advertising parameters.
        memset(&amp;amp;adv_params, 0, sizeof(adv_params));

        adv_params.primary_phy      = BLE_GAP_PHY_1MBPS;
        adv_params.primary_phy      = BLE_GAP_PHY_1MBPS;
        adv_params.duration         = advertise_timeout;
        adv_params.properties.type  = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
        adv_params.p_peer_addr      = NULL;
        adv_params.filter_policy    = BLE_GAP_ADV_FP_ANY;
        adv_params.interval         = advertise_interval;

        err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data, &amp;amp;adv_params);
        APP_ERROR_CHECK(err_code);

        #ifdef DEBUG
        printf(&amp;quot;Advertising at 1Mbps\r\n&amp;quot;);
        #endif

    }//tx_rate != BLE_GAP_PHY_CODED

    else{ //tx_rate == BLE_GAP_PHY_CODED

        //err_code = ble_advdata_encode(&amp;amp;srdata, m_adv_data_ext.scan_rsp_data.p_data, &amp;amp;m_adv_data_ext.scan_rsp_data.len);
        //APP_ERROR_CHECK(err_code);

        ble_gap_adv_params_t adv_params;

        // Set advertising parameters.
        memset(&amp;amp;adv_params, 0, sizeof(adv_params));

        adv_params.primary_phy      = BLE_GAP_PHY_CODED;
        adv_params.primary_phy      = BLE_GAP_PHY_CODED;
        adv_params.duration         = advertise_timeout;
        adv_params.properties.type  = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
        adv_params.p_peer_addr      = NULL;
        adv_params.filter_policy    = BLE_GAP_ADV_FP_ANY;
        adv_params.interval         = advertise_interval;

        err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data_ext, &amp;amp;adv_params);
        APP_ERROR_CHECK(err_code);

        #ifdef DEBUG
        printf(&amp;quot;Advertising at 125kbps CODED\r\n&amp;quot;);
        #endif

    }//tx_rate == BLE_GAP_PHY_CODED

    err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_adv_handle, tx_power);
    APP_ERROR_CHECK(err_code);

    #ifdef DEBUG
    printf(&amp;quot;advertising_init\r\n&amp;quot;);
    #endif
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/227247?ContentTypeID=1</link><pubDate>Thu, 02 Jan 2020 13:33:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:308cb982-e7fa-4876-b305-f0c6ea04e398</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Adam,&amp;nbsp;&lt;br /&gt;This code worked for me:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void advertising_init(void)
{
    ret_code_t    err_code;
    ble_advdata_t advdata;
    ble_advdata_t srdata;

    ble_uuid_t adv_uuids[] = {{LBS_UUID_SERVICE, m_lbs.uuid_type}};

    // Build and set advertising data.
    memset(&amp;amp;advdata, 0, sizeof(advdata));

    advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance = true;
    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;


    memset(&amp;amp;srdata, 0, sizeof(srdata));
    /*srdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
    srdata.uuids_complete.p_uuids  = adv_uuids;*/

    err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data.adv_data.p_data, &amp;amp;m_adv_data.adv_data.len);
    APP_ERROR_CHECK(err_code);

    err_code = ble_advdata_encode(&amp;amp;srdata, m_adv_data.scan_rsp_data.p_data, &amp;amp;m_adv_data.scan_rsp_data.len);
    APP_ERROR_CHECK(err_code);

    ble_gap_adv_params_t adv_params;

    // Set advertising parameters.
    memset(&amp;amp;adv_params, 0, sizeof(adv_params));

    adv_params.primary_phy     = BLE_GAP_PHY_CODED;
    adv_params.secondary_phy   = BLE_GAP_PHY_CODED;
    adv_params.duration        = APP_ADV_DURATION;
    adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
    adv_params.p_peer_addr     = NULL;
    adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
    adv_params.interval        = APP_ADV_INTERVAL;

    err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data, &amp;amp;adv_params);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Make sure the srdata is empty. Extended advertising doesn&amp;#39;t support scan response packet (which makes sense since it transfer extra data in the&amp;nbsp;data channels)&lt;/p&gt;
&lt;p&gt;To switch between PHY when in connection, please follow the sequence chart here:&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v6.1.1/group___b_l_e___g_a_p___p_e_r_i_p_h_e_r_a_l___p_h_y___u_p_d_a_t_e.html?cp=4_5_3_2_2_1_3_7_1"&gt;infocenter.nordicsemi.com/.../group___b_l_e___g_a_p___p_e_r_i_p_h_e_r_a_l___p_h_y___u_p_d_a_t_e.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/227105?ContentTypeID=1</link><pubDate>Mon, 30 Dec 2019 17:21:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72c692ad-61c0-4345-bc2e-96a16052b776</guid><dc:creator>Adam Gerken</dc:creator><description>&lt;p&gt;Honestly, I&amp;#39;m not too worried about 2MBPS, but coded is going to be really nice to have in the final application.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Switching up to 2MBPS at run time would be good.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/227100?ContentTypeID=1</link><pubDate>Mon, 30 Dec 2019 16:25:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c699a865-8080-4bf3-984d-fa310e4b5e65</guid><dc:creator>Adam Gerken</dc:creator><description>&lt;p&gt;Hung, The errors are all over the place depending on how I set up the&amp;nbsp;ble_gap_adv_data_t variables. I get DATA_SIZE and INVALID_PARAM.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve read that over and over and for some reason it doesn&amp;#39;t simply work. I&amp;#39;ve copied the code out of the example and it doesn&amp;#39;t work. Everything in that example seems to be slightly different than the blinky example my project is originally based on.&lt;/p&gt;
&lt;p&gt;So, how do I change the speed during the connection? I want to give the user/application the option to enable CODED/2MBPS if they want. Advertising and connecting in 1MBPS then changing seems fine, but it would also be great to be able to advertise/connect in CODED.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling 2MBPS and CODED PHYs</title><link>https://devzone.nordicsemi.com/thread/227097?ContentTypeID=1</link><pubDate>Mon, 30 Dec 2019 16:07:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00c0f464-8324-46b6-8bdf-516390948b8d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Adam,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you tell which exact error code do you have and on which function?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you had a look at this blog which has the example code ?&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/testing-long-range-coded-phy-with-nordic-solution-it-simply-works-922075585"&gt;https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/testing-long-range-coded-phy-with-nordic-solution-it-simply-works-922075585&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please be aware that, the PHY change can happens when the devices are in connection. So for 2Mbps most of the device will just advertise in 1Mbps first and then switch to 2Mbps after the connection is established (because not many phones scan in 2Mbps).&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>