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

Change GAP NAME

Hi all! I am currently using an nrf52840, mesh sdk v3.20 and sdk v15.30 

I have the following scenario which I am trying to solve:

I am receiving a new GAP name for each of my devices via serial, I then take that GAP name and store it in flash via the flash manager(user section). After a reset, the device should advertise the new name. 

Firstly, something I saw was creating the flash section before the mesh stack has been initialized causes a lockup,this does make sense to me because of the defragging taking place. 

Also,ble_stack_init() and gap_params_init() should be called before initializing the mesh stack. 

I have come up with the following solution, I just can't get it to work:

0. Bootup

1. Initialize user flash area, store and set default gap name

2. Initialize  mesh stack

3. New GAP name received, store in flash

4. Upon next boot, read the GAP name from flash and set it

I have read and tried the following:

https://devzone.nordicsemi.com/f/nordic-q-a/16602/change-advertised-devicename

https://devzone.nordicsemi.com/f/nordic-q-a/5855/is-it-possible-to-change-gap-device-name-in-runtime-without-system-reset

The following function does not change the GAP name successfully:

void change_gap_name(void)
{
  static char test_gap_name[] = "Test";

  uint32_t err_code;
  ble_gap_conn_sec_mode_t sec_mode;

  BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);

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

No luck!

Please can you kindly assist?

Regards

Chris

Parents Reply Children
No Data
Related