This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Change advertisement name - still getting the previous one for some time

Hello everyone,

I have been dealing with this issue for some time now, and I think it's time to find a definitive solution, I am sure there is one!

For my projects, most of the time I re-use the code of a previous project as a starting point.....and every time I have to deal with this annoying problem!

In my main.c file, I specify the DEVICE_NAME as done in the Nordic Uart_ble example, and I use this name to setup the gap parameters of the new project with the code

    err_code = sd_ble_gap_device_name_set(&sec_mode,
                                          (const uint8_t *)DEVICE_NAME,
                                          strlen(DEVICE_NAME));


Then, I would expect that when the advertising starts, I have the new DEVICE_NAME transmitted in the advertising....well, this is not the case!

Let's assume the previous project was advertising with DEVICE_NAME= OldAdvertisingName, and that I want now to create a new project and advertise the

DEVICE_NAME = NewFancyProject.

My problem is that every time, I have to reset/restart/erase/ and do a lot of other apparently random things for the new advertising name transmitted correctly!

At some point, with no apparent (to me) reason, the NRF52 starts transmitting the NewFancyProject name, and then it continues to work properly.

So my question is the following: where else in the code should I modify the OldAdvertisingName, to have the new name advertised immediately?

What am I missing when I modify a project?

I am working on a custom board, so if there is a button combination to use, please indicate me the function that is called by the button sequence if possible.

Thanks for your help

Lorenzo

Related