<?xml-stylesheet type="text/xsl" href="https://test-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/"><channel><title>How to update advertising data dynamically using BLE Advertising library</title><link>/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><description>Introduction
The question of how to update advertising data dynamically using the BLE Advertising library has been raised many times by our forum-goers, especially after the release of nRF5 SDK v15.2.0, in which the ble_advertising_advdata_update fun</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Wed, 06 Apr 2022 15:39:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user114984</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Answered my own question now. I believe it will cope with the situation I was looking at. I needed to reset the adv_data.len to it&amp;#39;s maximum before calling adv_data_encode&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Mon, 04 Apr 2022 10:14:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user114984</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hi Karl, great tutorial. I have a question about changing the manufaturer specific data length. In my application I want to increase the length of the manufacturer specific data field by 2 bytes after a certain point in time. My advertising data consistes of Flags, a dynamically changing manufacturer specific data field and a name field. The maximum length of all this is less than 31 bytes. I&amp;#39;ve found that when increasing the length of the manufacturer specific data and using ble_advdata_encode, the manufaturer data is handled correctly but the total length of the advertising data doesn&amp;#39;t increase, leading to a truncated name field. I am passing a length of 31 bytes with my&amp;nbsp;ble_gap_adv_data_t signal (unless that is being changed by another process I don&amp;#39;t see)&amp;nbsp; Would the Update_advertising_data handle this case&lt;br /&gt;Thanks&lt;br /&gt;Mike&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Wed, 23 Feb 2022 07:30:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user113739</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;hello everyone,&lt;/p&gt;
&lt;p&gt;i want to use this example for 15.3 SDK but its not working so anybody have any suggestion please let me know.&lt;/p&gt;
&lt;p&gt;thanking you.&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Wed, 16 Feb 2022 11:10:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user113598</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Finally I have managed to build the solution with correct paths to all logging functions. But same as the defualt template app it ends in the &amp;quot;NRF_BREAKPOINT_COND&amp;quot; right after starting up. Please would you be so kind and try to help a little. The immediate failure of the code is same also for the template ble app.&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Wed, 16 Feb 2022 09:14:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user113598</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Dear friends, I downloaded fresh SDK 17.0.2 and copy your linked example to the examples. I am using SES, I am not able to compile the project. Other examples worked just fine. Your linked example have problems with paths to logging things and even I tried to fix it it started to have problem to found files like sdk_common.h and I am not able to fix. Would be possible to fix the linked example so it will work just OK like your other examples among downloaded SDK. Or any other advice will be much helpful for me.&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Thu, 10 Feb 2022 18:16:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user111673</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;This is a good example of a project that I am currently working on.&amp;nbsp; I could use some clarifications in the function &amp;quot;adv_data_update_timer_handler.&amp;quot;&amp;nbsp; 1. You define PAYLOAD_SIZE as 1 but there are 6 uint8_t types of data in the actual list.&amp;nbsp; Is this a typo?&amp;nbsp; 2. There is a static variable defined payload_index in the function and initialized to zero. Later in the function you test that variable against a defined TOP_INDEX which equals 5.&amp;nbsp; Can you explain how the payload_index will ever increment to the TOP_INDEX level because of being set to zero upon entry into the function?&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Wed, 03 Nov 2021 20:16:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user16216</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hi Karl,&lt;/p&gt;
&lt;p&gt;after having stumbled over the implementation for updating advertising information in SDK 15.3 I was glad to find this explanation and demonstration for the new SDK 16.0 implementation of ble_advertising_advdata_update. That&amp;#39;s exactly what I need.&lt;/p&gt;
&lt;p&gt;Before adding this to our project I downloaded your example code to test it on a nRF52840 PDK and nRF-Connect on my Android smartphone. (Android 10, also tested with another phone with Android 8). &lt;br /&gt; I placed the sample code into the examples folder of a Android 17.0.2 SDK, and I&amp;#39;m using SES (Segger Studio) v 5.64&lt;/p&gt;
&lt;p&gt;My first impression was that it did not work at all, because I was looking for the original advertising name &amp;quot;&lt;strong&gt;Nordic_Template&lt;/strong&gt;&amp;quot;, but did not find it in nrfConnect.&amp;nbsp; But after making some minor changes for seeing NRF_LOG messages with RTTview and a bit of debugging I found out the reason. The advertised Device name is correct at startup, i.e. after a Reset ( to be sure, I do not only test this after programming with SES, but explicitly issuing a Reset with SES. &lt;br /&gt; Whenever the Reset is issued, nRFConnecgt will show the correct Device name &lt;strong&gt;Nordic_Template&lt;/strong&gt;. As soon as the timer expires and the first &lt;strong&gt;ble_advertising_advdata_update&lt;/strong&gt; is invoked, the name in nRFConnect is &amp;quot;lost&amp;quot; and replaced by the typical &amp;quot;N/A (Nordic)&amp;quot; display. &lt;br /&gt; Note that the dynamic update of the ManufacturerSpecific Data works correctly as expected, i.e. for each timer event nRFConnect will show the updated information. This is good, but not at the cost of the wrong / missing device name during advertising.&lt;/p&gt;
&lt;p&gt;Before I start debugging this in detail myself, I would like to know whether it is expected behavior for this example to loose the device name ??&lt;br /&gt; In my application I definitely need correct advertising for all the information, including the device name.&lt;/p&gt;
&lt;p&gt;I add two screen shots of nRFConnect, the first one shows the &amp;quot;correct&amp;quot; information after a Reset of the nRF52840, the second one shows the &amp;quot;wrong&amp;quot; information after the first timer update with ble_advertising_advdata_update is excecuted.&amp;nbsp; This remains wrong for all subsequent timer events. &lt;br /&gt; Note that I changed the name from Nordic_Template to DX-1234.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-b31c1811-79ab-408a-89e3-080face2493e/6644.2021_2D00_11_2D00_02_5F00_22h02_5F00_28.png" /&gt;&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Tue, 14 Sep 2021 10:27:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user8498</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hi Karl&lt;br /&gt;&lt;br /&gt;Having looked through the many posts where everything was going wrong with advertising update, your demo worked perfectly first time.&amp;nbsp; I had been using the stop/update/start method for an update to live data within the advertising and scan response packets, but this method lets me use the new advertising module sequencing and have live updates without compromising the timing!&lt;br /&gt;&lt;br /&gt;Excellent example&lt;br /&gt;Many thanks&lt;br /&gt;&lt;br /&gt;Ken&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Thu, 19 Aug 2021 06:02:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user99300</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;i had interfaced lis3dh accelerometer with nrf52840 with I2C. I created a service AND was able to get lis3dh xyz values in characteristic. But now i want to simply advertise the lis3dh data without conncetion. pls assist&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Thu, 03 Jun 2021 13:56:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user99300</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;can you help how to add ibeacon data in eddystone program ble_app_eddystone. How to add ibeacon slot amongst UID TLM URL EID slot&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: How to update advertising data dynamically using BLE Advertising library</title><link>https://test-devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library</link><pubDate>Sat, 13 Feb 2021 08:47:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31c1811-79ab-408a-89e3-080face2493e</guid><dc:creator>user93931</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;x.Hi Karl&lt;/p&gt;
&lt;p&gt;Thanks for this very clear tutorial. Very helpful.&lt;/p&gt;
&lt;p&gt;I downloaded the example above &amp;#39;ble_app_update_advertising_data&amp;#39; and it worked for me - the data is updated every 5s.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tried to update data without timer. The condition to update data is when data changes. Example: status of the device. I&amp;#39;d like to advertise the status of the device in 1 Byte that is equal to 0x00 when all ok and then different from 0x00 if one of the components of the device fails. Is this possible?&lt;/p&gt;
&lt;p&gt;Many thanks&lt;/p&gt;&lt;img src="https://test-devzone.nordicsemi.com/aggbug?PostID=1352&amp;AppID=12&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>