Our product (nRF52810, SDK 15.3.0, SD 112 6.1.1) allows the user to change the device name, which typically happens once when new product is received. Our app stores the device name in EEPROM and on startup reads and sets it in call to sd_ble_gap_device_name_set().
err_code = sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *) deviceName, strlen(deviceName));
I've looked at a bunch of posts about this and understand that the app needs to 1) stop advertising, 2) call sd_ble_gap_device_name_set() with new device name, 3) re-initialize advertising, 4) start advertising. Using code from various posts, I've not been able to get it working. So instead I thought to simply restart the device after writing the new device name to EEPROM. The startup procedure will read the new device name from EEPROM and proceed with standard initialization.
To restart the device, the app calls sd_nvic_SystemReset(). This seems to work well, even with debugger attached. Any issues, concerns about this approach?
I do not see any issues with your approach. Seems pretty safe procedure. Just make sure to call the sd_nvic_SystemReset only after the write is complete to the EEPROM with the new device name
Wonderful. Thanks Susheel. Appears to work well.