<?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>Renaming connected device</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94492/renaming-connected-device</link><description>Hello Nordic 
 I am developing a sensor application using nRF52833. The user must be able to connect to the nRF52833 and give it a new name. I have a name characteristic that the user will write the new name to. When the nRF52833 receives the new name</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Jan 2023 20:50:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94492/renaming-connected-device" /><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/404195?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2023 20:50:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebf511d0-23b3-4589-b5a8-bed6526a8d30</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Thomas, it&amp;#39;s my pleasure to help. Glad to know it works. &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f603.svg" title="Smiley"&gt;&amp;#x1f603;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/404153?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2023 15:03:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6b0366e-2eab-440e-b337-ce46d3f207c2</guid><dc:creator>Thomas U</dc:creator><description>&lt;p&gt;Hello Hieu&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you very much, I am so happy, finally it works.&lt;/p&gt;
&lt;p&gt;Setting the full device name did the trick&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/263a.svg" title="Relaxed"&gt;&amp;#x263a;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void adv_data_update(void)
{
    ret_code_t                  err_code;

    NRF_LOG_INFO(&amp;quot;Updating advertising data!&amp;quot;);
    
    new_advdata.name_type = BLE_ADVDATA_FULL_NAME;
    err_code = ble_advertising_advdata_update(&amp;amp;m_advertising, &amp;amp;new_advdata, NULL);
    APP_ERROR_CHECK(err_code);  
    
    NRF_LOG_INFO(&amp;quot;Advertising data updated!&amp;quot;);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/401997?ContentTypeID=1</link><pubDate>Thu, 22 Dec 2022 16:59:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f89984b-8bd1-46d2-9dd4-d6e872191289</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hello Thomas,&lt;/p&gt;
&lt;p&gt;Sorry for the late follow up. How is your&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;new_advdata&lt;/span&gt; setup? Does it already include&amp;nbsp;the full device name field?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/401511?ContentTypeID=1</link><pubDate>Tue, 20 Dec 2022 12:50:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79858763-45db-4805-ac5e-ab35ce025277</guid><dc:creator>Thomas U</dc:creator><description>&lt;p&gt;Hello Hieu&lt;/p&gt;
&lt;p&gt;I am back and ready to&amp;nbsp;&lt;span&gt;tackle this issue&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The error was caused by calling&amp;nbsp;&amp;quot;ble_advertising_start()&amp;quot; twice. Now there is no errors.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;After renaming device and a disconnect,&amp;nbsp;the NRF52833 starts advertising again but it has lost its name. By using the nRF connect tool i see an advertisement from my NRF52833. I recognize the address: DE:A0:BB:0F:EF:9D. But the name is &amp;lt;Unknown name&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1671540359664v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/400948?ContentTypeID=1</link><pubDate>Thu, 15 Dec 2022 19:34:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b9d38f5-5079-4f41-bd2c-0598b8283bfc</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;I don&amp;#39;t think you need to worry about the DFU. Just supporting DFU is not going to cause problems with using breakpoints. It is the SoftDevice and its radio operations that don&amp;#39;t like breakpoints, and breakpoint throws their timing off and break communications.&amp;nbsp;Therefore, you won&amp;#39;t be able to resume from a breakpoint. We will use it as a tool to see how far the code go and what functions/branches got executed.&lt;/p&gt;
&lt;p&gt;We will resume when you get back though. Enjoy your vacation!&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f603.svg" title="Smiley"&gt;&amp;#x1f603;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/400934?ContentTypeID=1</link><pubDate>Thu, 15 Dec 2022 17:36:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d83d763-1845-4556-96ef-c553f14c5726</guid><dc:creator>Thomas U</dc:creator><description>&lt;p&gt;Hi Hieu, I really appreciate your help. Nice discovery that &amp;quot;ble_advertising_start()&amp;quot; is called by the module itself. The error that I received must be generated by calling&amp;nbsp;&amp;quot;ble_advertising_start()&amp;quot;&amp;nbsp;two times. When I delete the call to&amp;nbsp;&amp;quot;ble_advertising_start()&amp;quot;, there is no error, but the NRF52833 goes into a silent disconnected state without advertising. That is, if I do not change the device name, then the advertising works fine, but after a device name change and a disconnect the silent state occurs.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am using DFU and setting a breakpoint is not so easy. But searching this forum I see that it is possible.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am at a small Christmas vacation right now. I will be back in the office Tuesday. Then I can set breakpoints and continue solving this mystery&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f60a.svg" title="Blush"&gt;&amp;#x1f60a;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/400590?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2022 11:34:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b87f003-2793-45c1-bc65-02c2de83f41d</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Thomas,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I looked at the&amp;nbsp;Advertising Module more closely and see that adding a call to &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;ble_advertising_start()&lt;/span&gt; like I previously advised is not necessary. The module itself already done that, and you can see by looking at&amp;nbsp;its on_disconnected() function. ble_app_blinky() does not use the Advertising Module and thus need that setup.&lt;/p&gt;
&lt;p&gt;My apology about this.&lt;/p&gt;
&lt;p&gt;However, now I am confused why you initially don&amp;#39;t have advertising data then...&lt;/p&gt;
&lt;p&gt;Could you please use debug, put a breakpoint at &lt;span style="text-decoration:underline;"&gt;&lt;em&gt;the line that calls &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;ble_advertising_start()&lt;/span&gt; in &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;on_disconnected()&lt;/span&gt; in ble_advertising.c&lt;/em&gt;&lt;/span&gt;?&lt;/p&gt;
&lt;p&gt;If you could, it would be better to use breakpoint in &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;ble_advertising_start()&lt;/span&gt; itself to check exactly where the error was reported.&lt;br /&gt;But in doing this, you need to pay attention to only enable the breakpoint right before a disconnection. In an BLE application, a breakpoint&amp;nbsp;cannot be recovered from (because a halt in execution breaks BLE timing). Therefore, if you enable the breakpoint&amp;nbsp;from the beginning, you will run into it at the initial advertising start, before the connection is established.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/400457?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2022 17:01:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:044ccf3e-a69c-41f6-a1a7-640d4710a69b</guid><dc:creator>Thomas U</dc:creator><description>&lt;p&gt;Hi Hieu&lt;/p&gt;
&lt;p&gt;The &amp;quot;Fast advertising&amp;quot; message comes from the following function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for handling advertising events.
 *
 * @details This function will be called for advertising events which are passed to the application.
 *
 * @param[in] ble_adv_evt  Advertising event.
 */
static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
{
    ret_code_t err_code;

    switch (ble_adv_evt)
    {
        case BLE_ADV_EVT_FAST:
            NRF_LOG_INFO(&amp;quot;Fast advertising..&amp;quot;);
            err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_ADV_EVT_IDLE:
            sleep_mode_enter();
            break;

        default:
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The function that returns&amp;nbsp;&lt;span&gt;NRF_ERROR_INVALID_STATE is shown below. The error is generated by the call to &amp;quot;ble_advertising_start&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for starting advertising.
 */
static void advertising_start(bool erase_bonds)
{
    if (erase_bonds == true)
    {
        delete_bonds();
        // Advertising is started by PM_EVT_PEERS_DELETED_SUCEEDED event
    }
    else
    {
        ret_code_t err_code = ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);
        APP_ERROR_CHECK(err_code);
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/400221?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2022 16:32:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ae643c1-8ed9-44c0-836f-4843603249a6</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Thomas,&lt;/p&gt;
&lt;p&gt;Sorry, it seems I am unable to keep&amp;nbsp;the fast response going&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f61e.svg" title="Disappointed"&gt;&amp;#x1f61e;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Could you let me know what the function that outputs &amp;quot;Fast advertising&amp;quot; look like?&lt;/p&gt;
&lt;p&gt;And what&amp;nbsp;function returns NRF_ERROR_INVALID_STATE? Was it &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;ble_advertising_advdata_update()&lt;/span&gt;?&lt;br /&gt;If so, the possible causes are documented here: &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__ble__advertising.html#ga99dab70061ce04aea98bf226dc0c989f"&gt;ble_advertising_advdata_update()&lt;/a&gt;&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Please&amp;nbsp;notice that it also returns any error code that the functions it uses return. For NRF_ERROR_INVALID_STATE,&amp;nbsp;&lt;span&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;sd_ble_gap_adv_set_configure()&lt;/span&gt; is also relevant;&amp;nbsp;and the possible causes are documented here: &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html#ga9969047f4e7485c3f856c841978cc31a"&gt;sd_ble_gap_adv_set_configure()&lt;/a&gt;&lt;/span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hieu&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/399994?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2022 16:56:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:adfebee5-4ee7-4173-8af8-5d80375a132d</guid><dc:creator>Thomas U</dc:creator><description>&lt;p&gt;Hi Hieu&lt;/p&gt;
&lt;p&gt;Thank you for answering me so fast. I have tried to follow your example from ble_app_blinky. In connected mode the user requests a new name. I set the new name using set_device_name and I call the adv_data_update() function, that contains&amp;nbsp;&lt;span&gt;ble_advertising_advdata_update.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    if (is_new_device_name_requested()) // if the user has requested a new name for this sensor, then go ahead and set it
    {
        NRF_LOG_INFO(&amp;quot;setting new device name&amp;quot;);
        set_device_name(DEVICE_NAME);
        adv_data_update();
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then my codes receive an event from the bluetooth stack. I try to follow the blinky example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for handling BLE events.
 *
 * @param[in]   p_ble_evt   Bluetooth stack event.
 * @param[in]   p_context   Unused.
 */
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    ret_code_t err_code = NRF_SUCCESS;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_DISCONNECTED:
            NRF_LOG_INFO(&amp;quot;Disconnected.&amp;quot;);
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
            advertising_start(false);
            break;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The NRF52833 crashes with NRF_ERROR_INVALID_STATE error.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: setting new device name
&amp;lt;info&amp;gt; app: Updating advertising data!
&amp;lt;info&amp;gt; app: Advertising data updated!
&amp;lt;info&amp;gt; app: Fast advertising.
&amp;lt;info&amp;gt; app: Disconnected.
&amp;lt;error&amp;gt; app: ERROR 8 [NRF_ERROR_INVALID_STATE] at R:\Produkter\HBCLS\4.Produktion\Software\Release\Git control\nRF5_SDK_17.1.0_ddde560\cal_sw\cal_sw\cal_sw\main.c:1449
PC at: 0x0002BCFD
&amp;lt;error&amp;gt; app: End of error report
&amp;lt;info&amp;gt; app: Setting vector table to bootloader: 0x00077000&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Before this crash, there is a log saying: &amp;quot;Fast advertising&amp;quot; and &amp;quot;Disconnected&amp;quot;. Maybe the advertising has somehow restarted already when I try to restart it. I have tried to comment out the advertising_start function call, but then there is no advertising following a device rename.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/399962?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2022 14:24:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:441e9b59-3e2c-457c-b335-8251e939d575</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Thomas,&lt;/p&gt;
&lt;p&gt;Sorry for my misunderstanding. I thought you meant that the name was not changed when you said nothing happens.&lt;/p&gt;
&lt;p&gt;Have you&amp;nbsp;explicitly called a function to start advertising when disconnection happen?&lt;/p&gt;
&lt;p&gt;For reference, this is the code doing so in the ble_app_blinky example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for handling BLE events.
 *
 * @param[in]   p_ble_evt   Bluetooth stack event.
 * @param[in]   p_context   Unused.
 */
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    ret_code_t err_code;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            // ... omitted ...
            break;

        case BLE_GAP_EVT_DISCONNECTED:
            NRF_LOG_INFO(&amp;quot;Disconnected&amp;quot;);
            bsp_board_led_off(CONNECTED_LED);
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
            err_code = app_button_disable();
            APP_ERROR_CHECK(err_code);
            advertising_start();
            break;
        
        // ... omitted ...
        
        default:
            // No implementation needed.
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/399959?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2022 14:15:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb296579-b62d-49cf-a47b-c336d4e012d8</guid><dc:creator>Thomas U</dc:creator><description>&lt;p&gt;Hi Hieu&lt;/p&gt;
&lt;p&gt;I am changing the name while being in connected mode. I am now using:&amp;nbsp;&lt;span style="color:#0000ff;"&gt;ble_advertising_advdata_update().&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="color:#000000;"&gt;From&amp;nbsp;Karls example I have used and modified the timer handler:&amp;nbsp;&lt;span style="color:#0000ff;text-decoration:underline;"&gt;static void adv_data_update_timer_handler(void * p_context)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;. I have converted it to a normal function because i do not need timers to trigger it. I have deleted the manufacturer specific data, because I solely want to change the device name. The modified code is shown below:&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static ble_advdata_t new_advdata;

static void adv_data_update(void)
{
    ret_code_t                  err_code;

    NRF_LOG_INFO(&amp;quot;Updating advertising data!&amp;quot;);
    
    err_code = ble_advertising_advdata_update(&amp;amp;m_advertising, &amp;amp;new_advdata, NULL);
    APP_ERROR_CHECK(err_code);  
    
    NRF_LOG_INFO(&amp;quot;Advertising data updated!&amp;quot;);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;While&amp;nbsp;the NRF52833 is connected a new name is given by the user and the function below is called:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void set_device_name(uint8_t* first_name)
{
    ret_code_t              err_code;
    ble_gap_conn_sec_mode_t sec_mode;

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;sec_mode);
    
    memset(full_device_name, 0, sizeof full_device_name);
    strcpy(full_device_name, first_name);
    strcat(full_device_name, general_par.last_device_name);

    err_code = sd_ble_gap_device_name_set(&amp;amp;sec_mode,
                                          (const uint8_t *)full_device_name,
                                          strlen(full_device_name));
    APP_ERROR_CHECK(err_code);
    general_par.is_new_device_name_wanted = false;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then I proceed to call the adv_data_update function. I have tried calling it from two code locations:&lt;/p&gt;
&lt;p&gt;1. Subsequent to the device name change&lt;/p&gt;
&lt;p&gt;2. After disconnection has occurred&lt;/p&gt;
&lt;p&gt;Below i 2 code snippets showing where I have called adv_data_udpate.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    if (is_new_device_name_requested()) // if the user has requested a new name for this sensor, then go ahead and set it
    {
        NRF_LOG_INFO(&amp;quot;setting new device name&amp;quot;);
        set_device_name(DEVICE_NAME);
        adv_data_update();&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for handling BLE events.
 *
 * @param[in]   p_ble_evt   Bluetooth stack event.
 * @param[in]   p_context   Unused.
 */
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    ret_code_t err_code = NRF_SUCCESS;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_DISCONNECTED:
            NRF_LOG_INFO(&amp;quot;Disconnected.&amp;quot;);
            adv_data_update();
            // LED indication will be changed when advertising starts.
            break;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The result is the same. When I disconnect the NRF52833 will not advertise. A power cycle is needed before i start advertising again.&amp;nbsp;Thank you for your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/399780?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2022 20:00:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a944d011-a1aa-4eae-8b8b-37ea4a60a6a8</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Thomas,&lt;/p&gt;
&lt;p&gt;Are you changing the name while advertising? I take a look at the design of the ble_advertising module and it seems it&amp;nbsp;isn&amp;#39;t intended for the &amp;quot;start &amp;gt; stop &amp;gt; update &amp;gt; start again&amp;quot; update method.&lt;/p&gt;
&lt;p&gt;The module does come with a function that is intended to help updating advertising&amp;nbsp;data. It is &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__ble__advertising.html#ga99dab70061ce04aea98bf226dc0c989f"&gt;ble_advertising_advdata_update()&lt;/a&gt;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;I have tested&amp;nbsp;using your code,&amp;nbsp;adjusting the bit that use &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;advertising_init()&lt;/span&gt; to use that function instead, and I can successfully get the advertising device name to update.&lt;/p&gt;
&lt;p&gt;One of our&amp;nbsp;colleagues, Karl, also wrote a great blog on updating advertising data, which include a sample code using that function in nRF5 SDK v17.1.0. You can find it here:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/how-to-update-advertising-data-dynamically-using-ble-advertising-library"&gt;How to update advertising data dynamically using BLE Advertising library&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you please tweak things&amp;nbsp;to use that function instead, and let me know if it works/does not work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/399538?ContentTypeID=1</link><pubDate>Wed, 07 Dec 2022 20:24:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17227ec0-8909-4bb3-8915-f679cf125b97</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Thomas,&lt;/p&gt;
&lt;p&gt;My apology that I didn&amp;#39;t follow-up yesterday as I said I would.&amp;nbsp;I will try to pinpoint what is wrong by the end of tomorrow, Thu 08 Dec.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/399185?ContentTypeID=1</link><pubDate>Tue, 06 Dec 2022 12:34:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b910cce5-2025-4fea-8345-c4fbd47e6a19</guid><dc:creator>Thomas U</dc:creator><description>&lt;p&gt;Hi Hieu&lt;/p&gt;
&lt;p&gt;Thank you for answering me so fast. My application doesn&amp;rsquo;t necessarily require that the NRF52 should disconnect and advertise the new name, when renamed. I would be sufficient that it advertises the new name after a disconnect. When I perform a disconnect from the BLE central the NRF52 do not advertise at all. It is silent until after a power cycle.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Renaming connected device</title><link>https://devzone.nordicsemi.com/thread/399103?ContentTypeID=1</link><pubDate>Tue, 06 Dec 2022 08:22:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef2720da-0408-4d7f-90be-fae112cc8341</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Thomas,&lt;/p&gt;
&lt;p&gt;Please know that we got your ticket. I cannot see anything immediately wrong here. I will take a closer look at it this morning and come back with an estimation later in the afternoon, unless someone from the community have already helped you by then.&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>