<?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>Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32824/dynamically-updating-advertising-data-in-sdk-15</link><description>(side note : it would have been handy if the migration guide mentioned that the advertising timeout configs have changed from seconds to 10&amp;#39;s of ms) 
 It seems to have become harder to dynamically update the advertising packet in SDK15. In SDK14, using</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 06 Aug 2023 10:25:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32824/dynamically-updating-advertising-data-in-sdk-15" /><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/440009?ContentTypeID=1</link><pubDate>Sun, 06 Aug 2023 10:25:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2eac3d51-859c-4e49-8db1-75d533f7923d</guid><dc:creator>RenanSP</dc:creator><description>&lt;p&gt;Thank you &lt;span&gt;very&amp;nbsp;very&lt;/span&gt; much!,&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/mdougherty"&gt;MDougherty&lt;/a&gt;!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/247700?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 20:02:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d87f4e0-e803-466f-8b2d-61395ce4fd8e</guid><dc:creator>MDougherty</dc:creator><description>&lt;p&gt;ShannonPahl,&lt;/p&gt;
&lt;p&gt;You sure showed me for starting with &amp;quot;&lt;span&gt;While the original poster has likely moved on...&amp;quot;!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for starting this thread and helping point people to good resources :)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/247698?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 19:57:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b18d79d-305a-437f-b024-f652d773a19e</guid><dc:creator>MDougherty</dc:creator><description>&lt;p&gt;Hello Josh West,&lt;/p&gt;
&lt;p&gt;I am glad you brought that weakness up as I&amp;nbsp;&lt;em&gt;almost&lt;/em&gt; mentioned it in my post before&amp;nbsp;deciding the post was already long enough as it was ^-^&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You are correct that we cannot guarantee that the BLE stack will not read&amp;nbsp;the advertising data&amp;nbsp;when we are in the middle of the update if we are executing our changes in a regular runtime, and this limitation is important to point out.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There may be a way to protect ourselves from this, however, by using an interrupt to dynamically update the advertising data (this could be hardware or software driven) as the BLE Soft Device uses interrupt priorities of 1,4, and 5. Particularly, it uses priorities 4 and 5 for the BLE stack (GAP, GATT) and uses priority 1 for the radio. Thus, if the dynamic update of the advertising data happens in an interrupt of priority 2 or 3 we can be certain that the advertising data will not be read until we finish writing.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That being said, this interrupt would have to be very fast to avoid any timing issues with the BLE stack (I can&amp;#39;t find the post now, but one Nordic developer recommended a few dozen microseconds for interrupts at priorities of 2 or 3 when using the BLE Soft Device).&amp;nbsp;To see how safe we would be with timing&amp;nbsp;we can run some numbers and note that advertising data is a max of 31 bytes&amp;nbsp;and a STR instruction on the Cortex M4 (the NRF52840 MPU) takes&amp;nbsp;two clock cycles. Let&amp;#39;s be very generous and assume each of those 31 writes to memory takes 10 cycles (due to the prep involved), and let&amp;#39;s assume that entering and leaving the interrupt takes 100 cycles each- at 64MHz we would still complete all of those cycles in about 8 microseconds. This is well within a few dozen microseconds, with some time left over for a few more quick operations.&lt;/p&gt;
&lt;p&gt;In fact, this is what my team did since we only updated the advertising data when a sensor value changed. We had the sensor trigger an interrupt and updated the advertising data in its interrupt service routine.&lt;/p&gt;
&lt;p&gt;I think for many situations your multi-buffer approach may be more appropriate,&amp;nbsp;is quite elegant, and it plays within the SDK (which is always a plus). I merely wanted to provide an alternative approach for&amp;nbsp;those scouring the forums for&amp;nbsp;potential solutions, and noted that this method hadn&amp;#39;t been shared yet.&lt;/p&gt;
&lt;p&gt;Glad to hear back from you :D&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/247695?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 19:16:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43405689-6d80-4fdb-aadb-4a1302e07e73</guid><dc:creator>ShannonPahl</dc:creator><description>&lt;p&gt;We are also using the double buffering approach I linked to previously, since we update more than one byte&amp;nbsp;but&amp;nbsp;not more frequently than 1-10&amp;nbsp;minutes.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38056/advertising-data-update-nrf_error_invalid_addr"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/38056/advertising-data-update-nrf_error_invalid_addr&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/247684?ContentTypeID=1</link><pubDate>Fri, 01 May 2020 14:54:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b32f354-eeee-4e16-ac6a-fb5a149a34ed</guid><dc:creator>Josh West</dc:creator><description>&lt;p&gt;Hi MD,&lt;/p&gt;
&lt;p&gt;I do believe I initially used your idea as my solution, but ultimately felt it was flawed due to the fact that I could not guarantee that the BLE stack would not send an advertisement out while I was in the middle of updating the data. For you it may not be an issue because you seem to only be updating a single byte; this was not my case. I am sure there may be some methods to ensure the data is updated &amp;quot;atomically&amp;quot; with regards to an advertisement packet being sent, but I opted to update the adv_data pointer to a different buffer instead as this just felt more reliable, IMO.&lt;/p&gt;
&lt;p&gt;Again, I find no issue with your solution for your particular case.&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/247656?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2020 21:39:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a4e6acf-805b-4e46-85c6-c359db9be980</guid><dc:creator>MDougherty</dc:creator><description>&lt;p&gt;While the original poster has likely moved on, I am posting for others who come here with a similar issue.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;My team also wanted to update the advertising data of a device dynamically. Stripping away any&amp;nbsp;details that are beyond the scope of the question,&amp;nbsp;our use case was a sensor which would advertise 1 when sensing an event and advertise 0 when not sensing an event.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We ran into the same problems using the SDK and API to dynamically update the advertising data as others here and in other forum posts.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We did find a working and efficient solution, however, and it is as follows:&lt;/p&gt;
&lt;p&gt;Note the&amp;nbsp;&lt;span&gt;ble_gap_adv_data_t struct which holds the advertising data. When initialized it would look something like:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static uint8_t m_adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;                   /**&amp;lt; Advertising handle used to identify an advertising set. */
static uint8_t m_enc_advdata[BLE_GAP_ADV_SET_DATA_SIZE_MAX];                    /**&amp;lt; Buffer for storing an encoded advertising set. */
static uint8_t m_enc_scan_response_data[BLE_GAP_ADV_SET_DATA_SIZE_MAX];         /**&amp;lt; Buffer for storing an encoded scan data. */

/**@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

    }
};&lt;/pre&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The .adv_data.p_data data field is the right place to be looking. So let&amp;#39;s follow&amp;nbsp;.adv_data.p_data through the code and see what happens...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;First, let&amp;#39;s look at the relevant bits of advertising_init()&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void advertising_init(void)
{
    .
    .
    .

    // Build and set advertising data.
    ble_advdata_t advdata;
    memset(&amp;amp;advdata, 0, sizeof(advdata));
    
    uint8_t data[]                      = {0xDE, 0xAD, 0xBE, 0xEF};
    manuf_data.company_identifier       = 0x0059;
    manuf_data.data.p_data              = data;
    manuf_data.data.size                = sizeof(data);
    advdata.p_manuf_specific_data       = &amp;amp;manuf_data;

    advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance = true;
    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

    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);
    
    NRF_LOG_INFO(&amp;quot;m_adv_data.adv_data.p_data address %p&amp;quot;, m_adv_data.adv_data.p_data);
    
    // Build and set scan response data.
    .
    .
    .

    // Build and set advertising parameters.
    ble_gap_adv_params_t adv_params;
    .
    .
    .

    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;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Of important note here is that, to keep with Bluetooth standards, the ble_advdata_encode() function is used. This is because, from&amp;nbsp;&lt;a title="Source" href="https://www.silabs.com/community/wireless/bluetooth/knowledge-base.entry.html/2017/02/10/bluetooth_advertisin-hGsf"&gt;Source&lt;/a&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;quot;...the term&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;advertising data&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;refers to the 0..31 byte long payload that is available for application use. (In Bluetooth Core specification this field is referred to as AdvData).&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Advertising data consists of one or more&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;Advertising Data (AD)&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;elements&lt;/strong&gt;. Each element is formatted as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1st byte:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;length&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;of the element (excluding the length byte itself)&lt;/li&gt;
&lt;li&gt;2nd byte:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;AD type&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&amp;ndash; specifies what data is included in the element&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AD data&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&amp;ndash; one or more bytes - the meaning is defined by&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;em&gt;&lt;strong&gt;AD type&lt;/strong&gt;&amp;quot;&lt;/em&gt;&lt;em&gt;&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Which is why our dynamic advertising data is in the manufacturer-specific data field.&lt;/p&gt;
&lt;p&gt;So we don&amp;#39;t want to simply override the entire&amp;nbsp;&lt;span&gt;.adv_data.p_data or we will not be in compliance with Bluetooth standards (unless you take care to format your payload yourself).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The last call in the advertising_init() snippet was:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data, &amp;amp;adv_params);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;which is a Soft Device call so all we can look at is the declaration of that function which can be found&amp;nbsp;in ble_gap.h:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;SVCALL(SD_BLE_GAP_ADV_SET_CONFIGURE, uint32_t, sd_ble_gap_adv_set_configure(uint8_t *p_adv_handle, ble_gap_adv_data_t const *p_adv_data, ble_gap_adv_params_t const *p_adv_params));&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;...noting that SVCALL is a macro defined in nrf_svc.h and that this whole thing really does turn into a function definition. So why did we come all this way to look at a messy function declaration? We came so we could see the parameter&amp;nbsp;ble_gap_adv_data_t const *p_adv_data, and in particular note that the pointer it is looking for is a constant. Therefore, while we can&amp;#39;t know what&amp;nbsp;sd_ble_gap_adv_set_configure(...) is doing since the soft device is proprietary, we&amp;nbsp;&lt;em&gt;can&lt;/em&gt; know that it expects the pointer to the advertising data to never change, which suggests the soft device will keep looking in the same location for advertising data (testing have verified this).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And that brings us to our solution, because&amp;nbsp;&lt;em&gt;we&lt;/em&gt; defined m_adv_data, so we can directly write to its address in memory. Writing to it is easy, we just use memcpy() or something like:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;m_adv_data.adv_data.p_data[your_offset] = 0x01;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The only thing you need to do is determine your_offset, which is the where in p_data we want to put our dynamically updated payload, as it is going to be different depending on what fields you have in your advertising payload. Remember, we can&amp;#39;t just write anywhere in p_data because the format is standardized, and only certain fields are meant to convey arbitrary data.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And now you may realize why&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;NRF_LOG_INFO(&amp;quot;m_adv_data.adv_data.p_data address %p&amp;quot;, m_adv_data.adv_data.p_data);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;was in the advertising_init() function, and why the&amp;nbsp;manuf_data.data.p_data was set to 0xDEADBEEF... it was so we could run the debugger to find the offset we need to write directly to&amp;nbsp;&lt;em&gt;the manufacturer-specific data section of&lt;/em&gt; m_adv_data.adv_data.p_data.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Now, if we ran the debugger and look at the logs&amp;nbsp;we would see the address of m_adv_data.adv_data.p_data printed. Then, we would go to the view-&amp;gt;debug-&amp;gt;memory option in Segger Embedded Studio and go to that address and look for&amp;nbsp;0xDEADBEEF. You count the bytes from the address of&amp;nbsp;m_adv_data.adv_data.p_data to the first D in&amp;nbsp;0xDEADBEEF to get your offset.&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As for my team&amp;#39;s use case, we can now dynamically update the advertising data by writing&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;m_adv_data.adv_data.p_data[11] = 0x01;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;when the sensor picks up an event and&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;m_adv_data.adv_data.p_data[11] = 0x00;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;when it does not. This is a simple solution that bypasses using the advertising update functions of the SDK, and avoids other complex solutions like double buffering. It is just one line to change the advertising data dynamically.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Just be mindful, as since you are writing directly to memory nothing is error checking what you are writing.&amp;nbsp;&lt;em&gt;You&lt;/em&gt; need to make sure that you don&amp;#39;t write more characters than your field allows, that you update the offset if you change the number of fields in the advertising payload, and that you don&amp;#39;t write anything which breaks the Bluetooth standard (such as writing over length fields, etc).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hope that helps.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/203179?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 23:31:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d311bd22-d0c3-4dbe-ad04-790c293e88a2</guid><dc:creator>ShannonPahl</dc:creator><description>&lt;p&gt;This approach seems to be working efficiently and well&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38056/advertising-data-update-nrf_error_invalid_addr"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/38056/advertising-data-update-nrf_error_invalid_addr&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/196945?ContentTypeID=1</link><pubDate>Sat, 06 Jul 2019 15:39:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7e056ca-8c25-44b2-a177-7391567d73e2</guid><dc:creator>testsweng</dc:creator><description>&lt;p&gt;has anyone got the &lt;span class="user-name"&gt;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/stratosphere"&gt;Stratosphere&amp;nbsp; working?&amp;nbsp; If so can you enlighten us.&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="user-name"&gt;Thanks&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/161390?ContentTypeID=1</link><pubDate>Wed, 12 Dec 2018 10:34:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:769f93b6-2ef2-455b-9ed1-6a2a178ec4dc</guid><dc:creator>ilkobg</dc:creator><description>&lt;p&gt;Hello Stratosphere,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you for the brief explanation to your approach. I have one question; Let&amp;#39;s assume that you&amp;nbsp;define advertising data as described:&lt;/p&gt;
[quote userid="75719" url="~/f/nordic-q-a/32824/dynamically-updating-advertising-data-in-sdk-15/160852"]static uint8_t m_enc_advdata[BLE_GAP_ADV_SET_DATA_SIZE_MAX] =&lt;br /&gt;{&lt;br /&gt;03, 0x19, 0x00, 0x00, //flags&lt;br /&gt;02, 0x01, 0x06, //apperance&lt;br /&gt;13, 0xFF, 0x59, 0x00, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 //manufacturer specific data&lt;br /&gt;};[/quote]
&lt;p&gt;&amp;nbsp;I can do it also, since I know what my adv packet looks like. But how you cope with the initialization of the advertising instance? I mean, in the classic approach for the function advertising_init(), we have&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ble_advertising_init_t init;


typedef struct
{
    ble_advdata_t           advdata;       /**&amp;lt; Advertising data: name, appearance, discovery flags, and more. */
    ble_advdata_t           srdata;        /**&amp;lt; Scan response data: Supplement to advertising data. */
    ble_adv_modes_config_t  config;        /**&amp;lt; Select which advertising modes and intervals will be utilized.*/
    ble_adv_evt_handler_t   evt_handler;   /**&amp;lt; Event handler that will be called upon advertising events. */
    ble_adv_error_handler_t error_handler; /**&amp;lt; Error handler that will propogate internal errors to the main applications. */
} ble_advertising_init_t;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;structure, which holds all parameters for the advertising module. We should define the advertising data through the ble_advdata_t structure. How you cope with this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/160852?ContentTypeID=1</link><pubDate>Sun, 09 Dec 2018 16:33:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56482d0b-a8bd-468e-a930-c21436ab2b78</guid><dc:creator>Stratosphere</dc:creator><description>&lt;p&gt;Hi Ranjeesh,&lt;/p&gt;
&lt;p&gt;I am developing on nrf52840 DK, S140, SDK15.2&lt;/p&gt;
&lt;p&gt;Assumptions: I want to update the advertisement data at every advertisement at 1.0 second interval. Assuming the data is contained within the manufacturing specific data at index 0 , right after the&amp;nbsp;company identifier. I am only changing 1 byte for the sake of explanation.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;em&gt;&lt;strong&gt;Background:&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The advertising_init(void) function contains the following for the advert data:&lt;/p&gt;
&lt;p&gt;memset(&amp;amp;advdata, 0, sizeof(advdata));&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; //advdata.name_type = BLE_ADVDATA_FULL_NAME;&lt;br /&gt; advdata.include_appearance = true;&lt;br /&gt; advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;&lt;/p&gt;
&lt;p&gt;adv_manuf_data.data.p_data = adv_manuf_data_data;&lt;br /&gt; adv_manuf_data.data.size = sizeof(adv_manuf_data_data);&lt;br /&gt; adv_manuf_data.company_identifier = 0x0059; //Nordic&amp;#39;s company ID&lt;br /&gt; advdata.p_manuf_specific_data = &amp;amp;adv_manuf_data;&lt;/p&gt;
&lt;p&gt;err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data.adv_data.p_data, &amp;amp;m_adv_data.adv_data.len);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;--------------------------------&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;the advertisement data is stored in m_adv_data pointer (array), which itself points to m_enc_advdata array at initialization:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;static ble_gap_adv_data_t m_adv_data =&lt;br /&gt;{&lt;br /&gt; .adv_data =&lt;br /&gt; {&lt;br /&gt; .p_data = m_enc_advdata,&lt;br /&gt; .len = BLE_GAP_ADV_SET_DATA_SIZE_MAX&lt;br /&gt; },&lt;br /&gt; .scan_rsp_data =&lt;br /&gt; {&lt;br /&gt; .p_data = m_enc_scan_response_data,&lt;br /&gt; .len = BLE_GAP_ADV_SET_DATA_SIZE_MAX&lt;/p&gt;
&lt;p&gt;}&lt;br /&gt;};&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The m_enc_advdata is defined as:&lt;/p&gt;
&lt;p&gt;static uint8_t m_enc_advdata[BLE_GAP_ADV_SET_DATA_SIZE_MAX]&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;Actual part:&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;General rule of thumb is to avoid updating the pointer array while it is being accessed. In our case that translates to making sure the adv data is not being accessed by advertising when we update the data. To ensure this, setup radio notifications as described here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/tutorials/b/software-development-kit/posts/radio-notification"&gt;https://devzone.nordicsemi.com/tutorials/b/software-development-kit/posts/radio-notification&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Put the following code in advertising_init(void) function instead of instead of what is mentioned in the link provided above:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;err_code = radio_notification_init(3, NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, NRF_RADIO_NOTIFICATION_DISTANCE_NONE);&lt;/em&gt;&lt;br /&gt;&lt;em&gt; APP_ERROR_CHECK(err_code);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is generate an interrupt at the end of each advertisement. Now we are safe to update adv_data as:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;/**@brief Software interrupt 1 IRQ Handler, handles radio notification interrupts.&lt;/em&gt;&lt;br /&gt;&lt;em&gt; */&lt;/em&gt;&lt;br /&gt;&lt;em&gt;void SWI1_IRQHandler(bool radio_evt)&lt;/em&gt;&lt;br /&gt;&lt;em&gt;{&lt;/em&gt;&lt;br /&gt;&lt;em&gt; if (radio_evt)&lt;/em&gt;&lt;br /&gt;&lt;em&gt; {&lt;/em&gt;&lt;br /&gt;&lt;em&gt; bsp_board_led_invert(BSP_BOARD_LED_1);&amp;nbsp; &amp;nbsp;//just to provide a visual indication&lt;/em&gt;&lt;br /&gt;&lt;em&gt; m_enc_advdata[11] += 1;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; m_adv_data.adv_data.p_data = m_enc_advdata;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; // nrf_gpio_pin_toggle(BSP_LED_2); //Toggle the status of the LED on each radio notification event&lt;/em&gt;&lt;br /&gt;&lt;em&gt; }&lt;/em&gt;&lt;br /&gt;&lt;em&gt;}&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This works well for me and it is really fast. There is no need to encode the adv_data again as long as you know the index of the data byte you want to update. In my case, it is the data byte right after the company identifier, which for me is index 11 of the m_enc_advdata array.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Important&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I actually defined the m_enc_advdata array as per below since I know exactly what my advertisement data looks like:&lt;/p&gt;
&lt;p&gt;static uint8_t m_enc_advdata[BLE_GAP_ADV_SET_DATA_SIZE_MAX] =&lt;br /&gt;{&lt;br /&gt;03, 0x19, 0x00, 0x00, //flags&lt;br /&gt;02, 0x01, 0x06, //apperance&lt;br /&gt;13, 0xFF, 0x59, 0x00, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 //manufacturer specific data&lt;br /&gt;};&lt;/p&gt;
&lt;p&gt;Then i commented out the following code in advertising_init(void) functions since I do not want to construct the advertisement data any more:&lt;/p&gt;
&lt;p&gt;/*&lt;br /&gt; //advdata.name_type = BLE_ADVDATA_FULL_NAME;&lt;br /&gt; advdata.include_appearance = true;&lt;br /&gt; advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;&lt;/p&gt;
&lt;p&gt;adv_manuf_data.data.p_data = adv_manuf_data_data;&lt;br /&gt; adv_manuf_data.data.size = sizeof(adv_manuf_data_data);&lt;br /&gt; adv_manuf_data.company_identifier = 0x0059; //Nordic&amp;#39;s company ID&lt;br /&gt; advdata.p_manuf_specific_data = &amp;amp;adv_manuf_data;&lt;/p&gt;
&lt;p&gt;err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data.adv_data.p_data, &amp;amp;m_adv_data.adv_data.len);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;br /&gt;*/&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This allows me to use only one adv_data buffer and not have to encode the data everytime i need to update it.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/157831?ContentTypeID=1</link><pubDate>Sat, 17 Nov 2018 14:08:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6d9bb14-4dbe-49ae-8597-2076f5bcc1de</guid><dc:creator>Rajneesh</dc:creator><description>&lt;p&gt;Hi Jeff&lt;/p&gt;
&lt;p&gt;Can I have your full source code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/130132?ContentTypeID=1</link><pubDate>Fri, 27 Apr 2018 13:52:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7341080-7d6b-400e-9242-32acdc6a6181</guid><dc:creator>Siddhesh</dc:creator><description>&lt;p&gt;Updating the same init buffer in S132V6.0 works fine. The same code did not work for updating the init structure in S140V6.0. Your solution of having a second buffer works for the S140. There are still a couple more test I have to run.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/129962?ContentTypeID=1</link><pubDate>Thu, 26 Apr 2018 12:50:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:adb36b19-5aa9-4908-bbe3-672705d7ca0b</guid><dc:creator>run_ar</dc:creator><description>[quote user="spirit1"]Guys, do you have any problems with updating&amp;nbsp;advertising data after bonding?[/quote]
&lt;p&gt;Guess you are using another advertisement mode in that case, could the whitelist feature be enabled or something?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/128970?ContentTypeID=1</link><pubDate>Thu, 19 Apr 2018 12:28:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e73b8f47-d874-4c1b-ae72-2a2cfec266af</guid><dc:creator>kapi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can consider adding following function to the ble_advertising module:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static ret_code_t ble_adv_data_update(ble_advertising_t   * const p_advertising,
                                      ble_gap_adv_data_t  * const p_new_advdata_buf,
                                      bool                        permanent)
{
    if (permanent)
    {
        memcpy(&amp;amp;p_advertising-&amp;gt;adv_data, p_new_advdata_buf, sizeof(p_advertising-&amp;gt;adv_data));
        p_advertising-&amp;gt;p_adv_data = &amp;amp;p_advertising-&amp;gt;adv_data;
    }
    else
    {
        p_advertising-&amp;gt;p_adv_data = p_new_advdata_buf;
    }

    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;/p&gt;
&lt;p&gt;It should help with your issue. If you set permanent parameter to true, the advertising data will be permanently updated inside the ble_advertising module. Otherwise, the old data will be restored when you get next BLE_GAP_EVT_ADV_SET_TERMINATED event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/128312?ContentTypeID=1</link><pubDate>Fri, 13 Apr 2018 19:38:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a40da6a-9738-4e63-afca-6fea4c9ac0e3</guid><dc:creator>ShannonPahl</dc:creator><description>&lt;p&gt;no bonding here either&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/128311?ContentTypeID=1</link><pubDate>Fri, 13 Apr 2018 19:34:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c440b4ab-df78-4a31-9acf-a622847b7652</guid><dc:creator>Josh West</dc:creator><description>&lt;p&gt;Hi Spirit,&lt;/p&gt;
&lt;p&gt;I am not doing any pairing/bonding at all, so I can&amp;#39;t really help you there. Sorry.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/128308?ContentTypeID=1</link><pubDate>Fri, 13 Apr 2018 19:03:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b20b4709-a099-4c0d-b0dd-a31d47899a1a</guid><dc:creator>Spirit</dc:creator><description>&lt;p&gt;Guys, do you have any problems with updating&amp;nbsp;advertising data after bonding?&lt;br /&gt;For me all works. But only when I&amp;#39;m not bonded.&lt;br /&gt;If I make a bond, the advertising data stops updating :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/128136?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 20:30:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c36d8f5-a126-49c5-b70e-cca1895d89ce</guid><dc:creator>Josh West</dc:creator><description>&lt;p&gt;Well, I believe my error when updating the advertising data had to do with a call to&amp;nbsp;&lt;strong&gt;sd_ble_gap_adv_set_configure()&lt;/strong&gt; that was always passing in &amp;amp;gapDataSet[0], instead of a pointer to the next data set to use.&lt;/p&gt;
&lt;p&gt;So, at this point things seem to be working fairly well. I am still utilizing a gapDataSet[] with 3 elements that I cycle through, although now that I have fix the above issue, I am thinking I should be able to use just 2 sets to accomplish the updating.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/128119?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 16:14:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:678c8dd8-0b0c-45c4-a409-a472d3177689</guid><dc:creator>ShannonPahl</dc:creator><description>&lt;p&gt;According to &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s140.api.v6.0.0%2Fstructble__gap__adv__data__t.html"&gt;this&amp;nbsp;&lt;/a&gt;&amp;nbsp;link -&amp;nbsp;&amp;nbsp;&lt;span&gt;The data shall be kept alive until either: ...&amp;nbsp;Advertising data is changed. So, after calling&amp;nbsp;sd_ble_gap_adv_set_configure with p_adv_params = null, the buffer should be released. But it seems that is not what you are observing and you have occasional&amp;nbsp;errors.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/128115?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 15:29:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5ee726e-cf73-46ae-a81b-d07d48b88dfd</guid><dc:creator>Josh West</dc:creator><description>&lt;p&gt;I did verify that I am not seeing the BLE_GAP_EVT_ADV_SET_TERMINATED event after updating my advertising data/buffers. I let it run and update about 10 times without seeing the event in my&amp;nbsp;NRF_SDH_BLE_OBSERVER callback function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/127919?ContentTypeID=1</link><pubDate>Wed, 11 Apr 2018 20:50:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f61ccb53-7807-4682-93f0-44ae05e55d31</guid><dc:creator>Josh West</dc:creator><description>&lt;p&gt;Hmm... that would be great if it did. I have not noticed that.. but maybe I was not looking for it and just didn&amp;#39;t notice. I will try to verify that soon, but currently I&amp;#39;m working on getting the bootloader working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/127916?ContentTypeID=1</link><pubDate>Wed, 11 Apr 2018 20:27:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a35f159f-0cd4-4b7a-9659-8799ac64d90d</guid><dc:creator>ShannonPahl</dc:creator><description>&lt;p&gt;I think that when you switch buffers, at some point, you&amp;#39;ll get a&amp;nbsp;&lt;span&gt;BLE_GAP_EVT_ADV_SET_TERMINATED event to notify you when the previous buffer was released. Until then, you cant reuse that buffer. And if you are switching buffers yourself, its probably not going to work well with ble_advertising : when it transitions from fast to slow (or any transition), it will revert to using its buffers and not yours, so it will advertise old data at the new rate.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/127914?ContentTypeID=1</link><pubDate>Wed, 11 Apr 2018 20:23:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afd4bf42-b845-48fa-9066-39f7effeda6c</guid><dc:creator>Josh West</dc:creator><description>&lt;p&gt;I would rather not have to do stop and start because I would like to make sure the fast advertising timeout does not get reset. My advertisement data is updated roughly every 5 seconds and I have a fast adv. timeout of 60 seconds. The framework my company uses was designed around SDK 12.1 and integrates nicely with the fact that the advertising data could easily be updated on-the-fly.&lt;/p&gt;
&lt;p&gt;I have something that does work... most of the time. I have adapted the solution I was having trouble with earlier by adding 3 buffers to cycle through. Occasionally I get an assert. All I can assume is that I must be pointing to a buffer that is currently in use and somehow my logic for advancing to the next buffer is error prone. One hypothesis I have is that I may be calling it too quickly and I advance to the in-use buffer before it had a chance to update to the last buffer requested. I have not had the time to dig into the exact issue here though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/127911?ContentTypeID=1</link><pubDate>Wed, 11 Apr 2018 20:09:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:046798be-a37c-4919-9f72-30fdb402ad7a</guid><dc:creator>Jeff Seaman</dc:creator><description>&lt;p&gt;I have been working on this with SDK13.&amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;We want to advertise sensor data using the nRF52840 so I need to use SDK15.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have been trying what you suggested and here is what works for me.&lt;/p&gt;
&lt;p&gt;I set the advertising interval to the same as my update interval.&lt;/p&gt;
&lt;p&gt;then in the timer function I call advertisement_update()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NON_CONNECTABLE_ADV_INTERVAL    MSEC_TO_UNITS(2000, UNIT_0_625_MS) 
APP_TIMER_DEF(m_update_timer_id);
#define UPDATE_TIMER_INTERVAL			APP_TIMER_TICKS(2000)

void update_timer_handler(void * p_context){
	


	NRF_LOG_INFO(&amp;quot;timer handler\r\n&amp;quot;);
 
	advertisement_update();
	
	
}

uint8_t sensor_data = 0;


static void advertisement_update(void){
 ret_code_t err_code = sd_ble_gap_adv_stop(m_adv_handle);
  raw_adv_data_buffer1[7] = 0x23;
  raw_adv_data_buffer1[8] = sensor_data;
  ++ sensor_data;
    err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;adv_data1, &amp;amp;m_adv_params);
    APP_ERROR_CHECK(err_code);
     err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
    APP_ERROR_CHECK(err_code);
  }
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you need more code I can clean up what I am working with and post the whole thing.&amp;nbsp; But that would be In a day or two&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dynamically updating Advertising data in SDK 15</title><link>https://devzone.nordicsemi.com/thread/127052?ContentTypeID=1</link><pubDate>Thu, 05 Apr 2018 12:53:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c979c82-b3df-4017-93e7-5d2ff65c3368</guid><dc:creator>Josh West</dc:creator><description>&lt;p&gt;There is mention of this in the s140 v6.0.0 migration document under the &amp;#39;Configuring advertising parameters for an advertising set&amp;#39; section.&lt;/p&gt;
&lt;p&gt;&amp;quot;ble_gap_adv_params_t::timeout has been renamed ble_gap_adv_params_t::duration and is now measured in 10 ms units.&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>