<?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>BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106385/ble-advertisement-does-not-update-after-reflashing</link><description>Hello. I have been reading quite a bit about the BLE technology and after some time I have decided to start some hands on practise myself. 
 
 I use: 
 
 NCS v2.5.0 
 nRF52840DK nRF52840 development board 
 
 
 I have initially started with peripheral_ht</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Dec 2023 13:15:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106385/ble-advertisement-does-not-update-after-reflashing" /><item><title>RE: BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/thread/459366?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2023 13:15:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8680038a-b419-4be0-8b25-623d8dd2f932</guid><dc:creator>zazas321</dc:creator><description>&lt;p&gt;You are totally right. I had hts.c file in my project and that had an effect (even though no functions were called.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Not going to lie, this must be the dumbest thing I have seen in my programming experience. Just by having .c file in your project without any function calls there was a automatically a BLE service added. This person who wrote this code should&amp;nbsp;be sent to prison.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thank you for helping me out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/thread/459350?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2023 12:03:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d87334a9-0dba-4d06-850e-426067593ec0</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Look at the actual project files in the src folder, I bet there is a hts.c in there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/thread/459273?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2023 06:04:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13f7e993-704a-4db8-961e-d82269467dc3</guid><dc:creator>zazas321</dc:creator><description>&lt;p&gt;Are you referrng to this:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1701928562235v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If yes, that did not do anything.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;strong&gt;Experiment #2&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;To test if I can add new services, I have added the following to my code:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;static const struct bt_data ad[] = {
	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
	BT_DATA_BYTES(BT_DATA_UUID16_ALL, BT_UUID_16_ENCODE(BT_UUID_BAS_VAL))};
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;and in my prj.conf I have enabled:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_BAS=y&lt;/pre&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;After flashing the device and opening nRF Connect on my mobile phone, I see the new Battery Service appear but Health Thermometer still persists:&lt;/div&gt;
&lt;div&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1701928892472v3.png" /&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;I have also tried on multiple phones and all phones provided same results.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;The experiment above proves that:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;nRF52 device is capable of adding new service (Just like I added Battery Service)&lt;/li&gt;
&lt;li&gt;There is still no logical explanation on why the Health Thermometer service appears&lt;/li&gt;
&lt;li&gt;The issue regarding Health Thermometer persists on different devices (multiple phones).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I am really hoping that we can get to the bottom of this as this is really frustrating.&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/thread/459263?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 21:32:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7014b1b9-a2ab-4fda-9511-f97d8d76f2a0</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;I was wrong, HTS is actually its own source file in the example code (hts.c in src directory) and not activated via Kconfig nor device tree.&lt;/p&gt;
&lt;p&gt;Double check that this file is not actually present in your code - it does &lt;em&gt;not&lt;/em&gt; need any calls from main() to be active.&lt;/p&gt;
&lt;p&gt;Some devices &lt;em&gt;can&lt;/em&gt; cache device discovery data. NRF connect has a &amp;quot;Refresh services&amp;quot; menu option that should read service definitions fresh from the device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/thread/459253?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 19:27:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d2708c7-f23e-4bc0-8209-290ff44d37ef</guid><dc:creator>zazas321</dc:creator><description>&lt;p&gt;I appreciate your suggestion and I will go through the course but that is not the point. I am interested in debugging this issue as I am convinced that this is a bug and there should not be HTS service in my simple BLE example code. I dont know whole lot about BLE but I know enough to understand that this is not how it supposed to work.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Instead of suggesting various things, why dont you take a minute to try this out yourself and you will recreate the issue and realize that this should not happen.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/thread/459249?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 18:13:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6365607-1bf1-425b-a6da-1830d6c23c20</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Instead of stripping down existing project, you could potentially look at how to&amp;nbsp;&lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-2-bluetooth-le-advertising/topic/blefund-lesson-2-exercise-1/"&gt;set advertising data&lt;/a&gt;&amp;nbsp;in the&amp;nbsp;&lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/"&gt;BLE Fundamentals course&lt;/a&gt;.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/thread/459147?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 11:19:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4231982-aa3f-4d6e-a635-ab108c89e176</guid><dc:creator>zazas321</dc:creator><description>[quote userid="18935" url="~/f/nordic-q-a/106385/ble-advertisement-does-not-update-after-reflashing/459146"]The HTS service is probably included in the prj.conf. You might want to read the Zephyr documentation a little more, this RTOS has several configuration options (and files) that all apply to a project.[/quote]
&lt;p&gt;I thought that initially as well. But I do not think that is the case. Check my prj.conf, it does not have anything to do with HTS. I have basic understanding of Zephyr RTOS and I am aware of configuration files.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;See my prj.conf&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1701861351102v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;My build configuration is as following:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1701861456658v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Perhaps there is something strange going on here. Since I initially flashed the device with the peripheral_ht sample project (that definately had HTS service) and then I reflashed it with my own program, perhaps somehow the information got cached or saved somehow? Is that even a possibility?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am hoping that someone can try to recreate the issue to ensure that I am not the only one.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Steps to reproduce:&lt;/p&gt;
&lt;p&gt;1. flash the peripheral_ht sample project to nRF52840DK nRF52840&lt;/p&gt;
&lt;p&gt;2. flash my program&lt;/p&gt;
&lt;p&gt;3. Monitor services via nRF Connect app on the phone.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/thread/459146?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 11:14:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a89b77bc-78bd-41d3-aa97-eb61fd4af6b9</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;You can still &lt;em&gt;use&lt;/em&gt; breakpoints to inspect variables and registers - but you cannot resume after stopping.&lt;/p&gt;
&lt;p&gt;Otherwise use the LOG module.&lt;/p&gt;
&lt;p&gt;The HTS service is probably included in the prj.conf. You might want to read the Zephyr documentation a little more, this RTOS has several configuration options (and files) that all apply to a project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/thread/459145?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 11:06:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4dfd2f96-90a0-48e9-8530-0e3f6f6018b6</guid><dc:creator>zazas321</dc:creator><description>[quote userid="18935" url="~/f/nordic-q-a/106385/ble-advertisement-does-not-update-after-reflashing/459144"]Your screenshots show services &lt;em&gt;after connection and service discovery&lt;/em&gt;[/quote]
&lt;p&gt;Yeah your are probably right, I am probably not using the correct terminology here. I am still very new to BLE so apologies for that, but you understand what I meant?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In the screenshot, you see Health Thermometer primary service. How did that even get there since in my code I do not have anything related to Hearth Thermometer at all? I just simply have the most basic BLE peripheral example that I can do using Zephyr and that should not have any Health Thermometer services at all&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Regarding the crash during the breakpoint - that makes sense. But in that case how would I debug the code if I have any problems since I cannot use breakpoints?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Advertisement does not update after reflashing</title><link>https://devzone.nordicsemi.com/thread/459144?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 11:03:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:938fe4eb-9dea-4c43-8e67-18be5915b9b9</guid><dc:creator>Turbo J</dc:creator><description>[quote userid="97527" url="~/f/nordic-q-a/106385/ble-advertisement-does-not-update-after-reflashing"]hat there are 3 services being advertised. [/quote]
&lt;p&gt;Wrong usage of terminology here.&lt;/p&gt;
&lt;p&gt;Your screenshots show services &lt;em&gt;after connection and service discovery&lt;/em&gt; but not what is in the advertising packet(s). That is displayed in the nrf connect app in the &amp;quot;scanner&amp;quot; column that is to the left and thus invisible.&lt;/p&gt;
&lt;p&gt;The softdevice/bluetooth stack checks if the app code could obey the stric bluetooth timings and faults whenever these are not met - especially if the CPU was halted in a breakpoint or in an interrupt handler that had too &amp;quot;high&amp;quot; priority (which is a low &lt;em&gt;value&lt;/em&gt; in ARM NVIC).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>