<?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>how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66244/how-to-update-the-advertisement-packet</link><description>hi ... 
 how to update the advertisement packet .. I have seen many post regarding this ,I am not getting clear , anyone can share me the piece of code which will help me</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Sep 2020 08:27:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66244/how-to-update-the-advertisement-packet" /><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271693?ContentTypeID=1</link><pubDate>Mon, 28 Sep 2020 08:27:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5828f50-29ae-41c0-8bde-2bdfbce595b7</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="saral"]Thanks alot.. It worked , I have made changes as per you said[/quote]
&lt;p&gt;I am happy to hear that it is now working, great!&lt;/p&gt;
[quote user="saral"]and one more here i need to advertise my own name how to do that ?[/quote]
&lt;p&gt;You could use the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s140.api.v7.2.0%2Fgroup___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html&amp;amp;anchor=gae779f7eed346027dc4cbaf438352e5db"&gt;sd_ble_gap_device_name_set function&lt;/a&gt;&amp;nbsp;for this.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271626?ContentTypeID=1</link><pubDate>Sat, 26 Sep 2020 06:41:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:316cf748-4ce2-4bad-86c7-3d392b53d5b4</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;&lt;strong&gt;Thanks alot.. It worked , I have made changes as per you said&lt;/strong&gt;&amp;nbsp; and one more here i need to advertise my own name how to do that ? I am working on beacon example in this example gap function is not there&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271372?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 14:19:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9dc683e-e5aa-4a19-b8b4-fa3d8a4a8f32</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;[quote user="saral"][/quote]&lt;/p&gt;
&lt;p&gt;so i need to assign with my_temp&amp;nbsp;&lt;/p&gt;
&lt;p&gt;uint8_t my_temp[1]={90};&lt;/p&gt;
&lt;p&gt;m_raw_data_buffer1[]= my_temp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;is it so ? or wrong&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Well, you could do this, but you are here just creating a&amp;nbsp;&lt;em&gt;shallow copy&amp;nbsp;&lt;/em&gt;of the&lt;em&gt; my_temp&lt;/em&gt; variable.&lt;br /&gt;I do not know if this is intentional in your case.&lt;br /&gt;But yes, you should initialize the variables. If you do not initialize them, you have no way of knowing what the variable might start out to be. For example, the 0x47 you saw earlier could have been a result of your random initialization here.&lt;/p&gt;
&lt;p&gt;[quote user="saral"][/quote]&lt;/p&gt;
&lt;p&gt;because in update_advertising_init() function i am passing the my_temp as 40 .. 40 hex value is 0x32 .&amp;nbsp;&lt;/p&gt;
&lt;p&gt;myself i dono where i am getting the 0x47&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Could you try to test this again, but this time, having initialized your&amp;nbsp;&lt;em&gt;my_temp&amp;nbsp;&lt;/em&gt;variable to something else - like dec 0 or dec 100, and then changing it in the sensor_data funtion to dec 50. Try this, and let me know if you are seeing the same results.&lt;br /&gt;&lt;br /&gt;I see that you have made additions and edits to your previously shared code - please do not do this.&lt;br /&gt;I do not recommend doing this, since I then have to read through the code and&amp;nbsp;&lt;em&gt;remember&amp;nbsp;&lt;/em&gt;what you might have changed since my last comments. Instead, you should share only the snippets you have changed in your new replies, for example: &amp;quot;I have changed this and that function as shown below, and I am not seeing ... &amp;quot;.&lt;br /&gt;By adding and editing the previously shared code, you are also voiding all my previously written comments - as they are comments to code that no longer exist or is structured in the way that it was. This makes it hard for you too, if you ever are to go back and read these comments.&lt;br /&gt;&lt;br /&gt;In your appended&amp;nbsp;&lt;em&gt;sensor_data&amp;nbsp;&lt;/em&gt;function, you are trying to write&amp;nbsp;&lt;em&gt;my_temp[1],&amp;nbsp;&lt;/em&gt;buy&amp;nbsp;&lt;em&gt;my_temp&amp;nbsp;&lt;/em&gt;&lt;strong&gt;is an array of length 1.&amp;nbsp;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;You probably meant to write to&amp;nbsp;&lt;em&gt;my_temp[0]&lt;/em&gt; here.&lt;br /&gt;Furthermore, the change you have made in line 17 of your code snippet titled &lt;span&gt;&lt;strong&gt;update_advertising_data function&amp;nbsp;&lt;/strong&gt;does not make sense, as sensor_data is first called as a function, and then subsequently used as a variable. I think you meant to use my_temp here, but please do not make such additions and edits because it is incredible hard to read and account for, and in this case probably also wrong entirely.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In your appended&amp;nbsp;&lt;em&gt;sensor_data &lt;/em&gt;function&amp;nbsp;the value of&amp;nbsp;&lt;em&gt;my_temp[1]&lt;/em&gt; is set to 50, for the record. 50 decimal value is 0x32 in hex value, 40 decimal value is 0x28 in hex value.&lt;/p&gt;
&lt;p&gt;[quote user="saral"][/quote]&lt;/p&gt;
&lt;p&gt;because , my_temp will change it is not constant value&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i want dynamical data&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That is fine. The volatile modifier is used when a register or value might change without the compiler seeing that it can happen - such as if you are pointing to a register that is connected to an external interrupts.&lt;br /&gt;Global variables that are not declared&amp;nbsp;&lt;em&gt;const&amp;nbsp;&lt;/em&gt;can be changed as normal.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271336?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 12:19:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84a32ba3-087b-4e08-b697-39cb18893fbc</guid><dc:creator>ps_anu</dc:creator><description>[quote userid="87869" url="~/f/nordic-q-a/66244/how-to-update-the-advertisement-packet/271328"]From you code I can not see any content going into m_raw_data_buffer1 and 2. What are the contents of these?[/quote]
&lt;p&gt;so i need to assign with my_temp&amp;nbsp;&lt;/p&gt;
&lt;p&gt;uint8_t my_temp[1]={90};&lt;/p&gt;
&lt;p&gt;m_raw_data_buffer1[]= my_temp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;is it so ? or wrong&amp;nbsp;&lt;/p&gt;
&lt;p&gt;then&amp;nbsp;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/66244/how-to-update-the-advertisement-packet/271328"]Do I understand you correctly that you are seeing 0x47 as your manufacturing specific data with the above code, but you expected to see 0x32? Please elaborate on where you are getting these values from - what made you expect 0x32, and where does 0x47 come from?[/quote]
&lt;p&gt;&amp;nbsp;because in update_advertising_init() function i am passing the my_temp as 40 .. 40 hex value is 0x32 .&amp;nbsp;&lt;/p&gt;
&lt;p&gt;myself i dono where i am getting the 0x47&amp;nbsp;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/66244/how-to-update-the-advertisement-packet/271328"]&lt;em&gt;my_temp&amp;nbsp;&lt;/em&gt;is&amp;nbsp;&lt;em&gt;volatile&lt;/em&gt; - why is this?[/quote]
&lt;p&gt;because , my_temp will change it is not constant value&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i want dynamical data&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271328?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 12:07:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db8aaae9-08d6-4b4d-bcce-d9963340dee9</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="saral"]yes I tried i am getting the data as 0x47 raw output . I should get 0x32[/quote]
&lt;p&gt;From you code I can not see any content going into m_raw_data_buffer1 and 2. What are the contents of these?&lt;br /&gt;Furthermore, you are initializing your advertising manufacturer specific data to your&amp;nbsp;&lt;em&gt;my_temp&lt;/em&gt; variable - but you never actually initialize the contents of&amp;nbsp;&lt;em&gt;my_temp&lt;/em&gt; to anything. Is this on purpose?&lt;br /&gt;I see that&amp;nbsp;&lt;em&gt;my_temp&amp;nbsp;&lt;/em&gt;is&amp;nbsp;&lt;em&gt;volatile&lt;/em&gt; - why is this?&lt;br /&gt;&lt;br /&gt;Do I understand you correctly that you are seeing 0x47 as your manufacturing specific data with the above code, but you expected to see 0x32? Please elaborate on where you are getting these values from - what made you expect 0x32, and where does 0x47 come from?&lt;br /&gt;I also would like to point out that you main function will only change the advertising data once, and this happens before advertising actually starts - so you are not here changing it &amp;#39;during advertisement&amp;#39;, just to be clear.&lt;br /&gt;&lt;br /&gt;As a side note, I would also advice against using any&amp;nbsp;&lt;em&gt;magic numbers&lt;/em&gt; in your code. Instead, you should create a define or const variable together with your array declaration, to keep track of its intended size.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271280?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 09:47:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc903873-6047-4e6d-8693-54d024a2b45a</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;good to hear you karl ..&amp;nbsp;&lt;/p&gt;
&lt;p&gt;yes I tried i am getting the data as 0x47 raw output . I should get 0x32&lt;/p&gt;
&lt;p&gt;Here i am sharing the full code what are the changes i made&amp;nbsp; here. Kindly check please ,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;volatile static uint8_t my_temp[1];  // initially i am assigning 
static ble_gap_adv_data_t m_adv_data1 =
{
    .adv_data =
    {
        .p_data = m_raw_data_buffer1,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
    },
    .scan_rsp_data =
    {
        .p_data = NULL,
        .len    = 0

    }
};
static ble_gap_adv_data_t m_adv_data2 =
{
    .adv_data =
    {
        .p_data = m_raw_data_buffer2,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
    },
    .scan_rsp_data =
    {
        .p_data = NULL,
        .len    = 0

    }
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here it is advertising init function&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&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;
    uint8_t       flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;

    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 *) my_temp;
    manuf_specific_data.data.size   = 1;

    // Build and set advertising data.
    memset(&amp;amp;advdata, 0, sizeof(advdata));

    advdata.name_type             = BLE_ADVDATA_NO_NAME;
    advdata.flags                 = flags;
    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_NONCONNECTABLE_NONSCANNABLE_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.

    err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data1.adv_data.p_data, &amp;amp;m_adv_data1.adv_data.len);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data1, &amp;amp;m_adv_params);
    APP_ERROR_CHECK(err_code);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;then i am sending the sensor data to it&amp;nbsp;&lt;/p&gt;
&lt;p&gt;update_advertising_data function&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void sensor_data()
{

  my_temp[1]=50;

}

static void update_advertising_init(void)
{
    uint32_t      err_code;
    ble_advdata_t advdata;
    uint8_t       flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;
ble_advdata_manuf_data_t manuf_specific_data;
manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
    
     sensor_data();
   manuf_specific_data.data.p_data = sensor_data; // calling the above function uint8_t my_temp[1]={50}
    manuf_specific_data.data.size   = 1;

    // Build and set advertising data.
    memset(&amp;amp;advdata, 0, sizeof(advdata));

    advdata.name_type             = BLE_ADVDATA_NO_NAME;
    advdata.flags                 = flags;
    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_NONCONNECTABLE_NONSCANNABLE_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.

    err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data2.adv_data.p_data, &amp;amp;m_adv_data2.adv_data.len);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data2, NULL);
    APP_ERROR_CHECK(err_code);
}

int main(void)
{
    // Initialize.
    log_init();
    timers_init();
    leds_init();
    power_management_init();
    ble_stack_init();
    advertising_init();
 update_advertising_init();  //added
    // Start execution.
    NRF_LOG_INFO(&amp;quot;Beacon example started.&amp;quot;);
    advertising_start();

    // Enter main loop.
    for (;; )
    {
        idle_state_handle();
    }
}


&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271236?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 07:34:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9789c60-310e-486d-8fe2-deba24388deb</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="saral"]where i should include my new updating data ?&amp;nbsp; &amp;nbsp;and how to assign to&amp;nbsp;[/quote]
&lt;p&gt;I do not understand what you mean by this.&lt;br /&gt;You should set the contents of your&amp;nbsp;&lt;em&gt;m_adv_data2&lt;/em&gt; at the start of your &lt;em&gt;advertising_update&lt;/em&gt; function ( or if it is two static advertising data buffers, initialize them to the correct values ).&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271233?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 07:30:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40981090-a0b6-402b-9623-4a6e62a03b68</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;thanks for your response , where i should include my new updating data ?&amp;nbsp; &amp;nbsp;and how to assign to&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271232?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 07:24:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2e3db71-7e9d-4f44-b480-f8d0f8d7b66a</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again,&lt;/p&gt;
[quote user="saral"]I&amp;nbsp; am using 15.2 verion sdk . I Have created two buffers ..kindly check my code , is this correct ?[/quote]
&lt;p&gt;What happens when you try to run this code? Does it update your advertising data?&lt;br /&gt;The general approach looks correct, but I suspect that you have cut out some parts of the functions&amp;#39; code, so I can not say anything for certain.&lt;/p&gt;
[quote user="saral"]also explain how to use the advertise update function in 17 version sdk[/quote]
&lt;p&gt;The &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fgroup__ble__advertising.html&amp;amp;anchor=ga99dab70061ce04aea98bf226dc0c989f"&gt;ble_advertising_advdata_update&lt;/a&gt;&amp;nbsp;function updates the advertising and scan response data related to an advertising handle.&lt;br /&gt;If advertising has already started, it updates the advertising data without stopping and starting advertising.&lt;br /&gt;In SDK v.17.0.0 it is implemented like the following:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t ble_advertising_advdata_update(ble_advertising_t   * const p_advertising,
                                          ble_advdata_t const * const p_advdata,
                                          ble_advdata_t const * const p_srdata)
{
    VERIFY_PARAM_NOT_NULL(p_advertising);
    if (p_advertising-&amp;gt;initialized == false)
    {
        return NRF_ERROR_INVALID_STATE;
    }

    if ((p_advdata == NULL) &amp;amp;&amp;amp; (p_srdata == NULL))
    {
        return NRF_ERROR_NULL;
    }

    ble_gap_adv_data_t new_adv_data;
    memset(&amp;amp;new_adv_data, 0, sizeof(new_adv_data));

    if (p_advdata != NULL)
    {
        new_adv_data.adv_data.p_data =
            (p_advertising-&amp;gt;p_adv_data-&amp;gt;adv_data.p_data != p_advertising-&amp;gt;enc_advdata[0]) ?
             p_advertising-&amp;gt;enc_advdata[0] : p_advertising-&amp;gt;enc_advdata[1];
        new_adv_data.adv_data.len = adv_set_data_size_max_get(p_advertising);

        ret_code_t ret = ble_advdata_encode(p_advdata,
                                            new_adv_data.adv_data.p_data,
                                            &amp;amp;new_adv_data.adv_data.len);
        VERIFY_SUCCESS(ret);
    }

    if (p_srdata != NULL)
    {
        new_adv_data.scan_rsp_data.p_data =
            (p_advertising-&amp;gt;p_adv_data-&amp;gt;scan_rsp_data.p_data != p_advertising-&amp;gt;enc_scan_rsp_data[0]) ?
             p_advertising-&amp;gt;enc_scan_rsp_data[0] : p_advertising-&amp;gt;enc_scan_rsp_data[1];
        new_adv_data.scan_rsp_data.len = adv_set_data_size_max_get(p_advertising);

        ret_code_t ret = ble_advdata_encode(p_srdata,
                                            new_adv_data.scan_rsp_data.p_data,
                                            &amp;amp;new_adv_data.scan_rsp_data.len);
        VERIFY_SUCCESS(ret);
    }

    memcpy(&amp;amp;p_advertising-&amp;gt;adv_data, &amp;amp;new_adv_data, sizeof(p_advertising-&amp;gt;adv_data));
    p_advertising-&amp;gt;p_adv_data = &amp;amp;p_advertising-&amp;gt;adv_data;

    return sd_ble_gap_adv_set_configure(&amp;amp;p_advertising-&amp;gt;adv_handle,
                                        p_advertising-&amp;gt;p_adv_data,
                                        NULL);
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271186?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 18:01:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e29d4c7d-856a-4ce4-beea-e207775d8abc</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;hi ,&lt;/p&gt;
&lt;p&gt;karl Ylvisaker&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;nbsp; am using 15.2 verion sdk . I Have created two buffers ..kindly check my code , is this correct ? correct me if were wrong And also explain how to use the advertise update function in 17 version sdk&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static ble_gap_adv_data_t m_adv_data1 =
{
    .adv_data =
    {
        .p_data = m_raw_data_buffer1,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
    },
    .scan_rsp_data =
    {
        .p_data = NULL,
        .len    = 0

    }
};
static ble_gap_adv_data_t m_adv_data2 =
{
    .adv_data =
    {
        .p_data = m_raw_data_buffer2,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
    },
    .scan_rsp_data =
    {
        .p_data = NULL,
        .len    = 0

    }
};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static advertising_init()

{
......
.....

  memset(&amp;amp;advdata, 0, sizeof(advdata));

    advdata.name_type             = BLE_ADVDATA_NO_NAME;
    advdata.flags                 = flags;
    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_NONCONNECTABLE_NONSCANNABLE_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.

    err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data1.adv_data.p_data, &amp;amp;m_adv_data1.adv_data.len);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data1, &amp;amp;m_adv_params);
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static advertising_update()
{


_ _ _ _ _
 _ _ _
 
 
 err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data2.adv_data.p_data, &amp;amp;m_adv_data2.adv_data.len);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data2, NULL);
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update the advertisement  packet</title><link>https://devzone.nordicsemi.com/thread/271140?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 14:34:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6de6a64d-9a0b-4be0-b6aa-f35a3de54297</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Which SDK version are you working with?&lt;br /&gt;Are you planning to use the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_ble_advertising.html"&gt;Advertising library&lt;/a&gt;?&lt;br /&gt;If so, the easiest way to go about updating the advertising data is to use the&amp;nbsp;&lt;em&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fgroup__ble__advertising.html&amp;amp;anchor=ga99dab70061ce04aea98bf226dc0c989f"&gt;ble_advertising_advdata_update&amp;nbsp;&lt;/a&gt;&lt;/em&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fgroup__ble__advertising.html&amp;amp;anchor=ga99dab70061ce04aea98bf226dc0c989f"&gt;function&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If you are using an SDK version older than v.17, you will need to store two different advertising data buffers, and alternate between which data advdata buffer you provide the _advdata_update function.&lt;br /&gt;I.e you may not provide the&amp;nbsp;&lt;em&gt;advdata_update&lt;/em&gt; function with the same ( but modified ) advdata buffer that you provided during the last call to&amp;nbsp;&lt;em&gt;advdata_update&lt;/em&gt;.&lt;br /&gt;If you are using SDK version &amp;gt;= v.17 then the&amp;nbsp;&lt;em&gt;advdata_update&lt;/em&gt; function handles this for you.&lt;br /&gt;&lt;br /&gt;If you are working with an older SDK version, you might also &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/33606/updating-advertising-data-manuf-spec-data-in-sdk15"&gt;benefit from reading the discussion in this ticket&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>