<?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>Device Name set question</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3698/device-name-set-question</link><description>修改Device_Name.jpg 
 After programming, the device name cannot be changed.
Is there any solution that can achieve?
I know that I can change the paramter from the function in attached file.
But I need the method can make me change the device name after</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 May 2015 02:27:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3698/device-name-set-question" /><item><title>RE: Device Name set question</title><link>https://devzone.nordicsemi.com/thread/13417?ContentTypeID=1</link><pubDate>Thu, 14 May 2015 02:27:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a8f2a62-6b9c-4d1b-b3c3-839170c3d519</guid><dc:creator>Nikita</dc:creator><description>&lt;p&gt;On second thought, you can do it using pstorage for updating device name and const to read its value. Knowing exact address in flash in wich pstorage will keep your device name you can declare your const as described in the link in #1 with start address that you can calculate from pstorage and 32 bytes length.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device Name set question</title><link>https://devzone.nordicsemi.com/thread/13416?ContentTypeID=1</link><pubDate>Wed, 13 May 2015 20:56:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68dc8529-553d-4183-a860-f9f451aec32c</guid><dc:creator>Nikita</dc:creator><description>&lt;p&gt;Well, I did mention below in my answer that if you don&amp;#39;t really need to use const in your program then you can use pstorage for better use of flash memory. But if you really need to use const, then I don&amp;#39;t think there is another way to do it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device Name set question</title><link>https://devzone.nordicsemi.com/thread/13415?ContentTypeID=1</link><pubDate>Wed, 13 May 2015 20:51:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4be3abd-5a6d-4638-8799-9af702af0225</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;So you&amp;#39;re going around the back of pstorage straight to the underlying flash write and you&amp;#39;re using 1024 bytes for a device name that can only be 32 bytes long? There must be a better way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device Name set question</title><link>https://devzone.nordicsemi.com/thread/13414?ContentTypeID=1</link><pubDate>Wed, 13 May 2015 20:43:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f0aa1c3-1870-4961-afb5-7b79e4175d23</guid><dc:creator>Nikita</dc:creator><description>&lt;p&gt;You can do it with sd_flash_page_erase()/sd_flash_write() because the const array takes up the whole page (1024 bytes).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device Name set question</title><link>https://devzone.nordicsemi.com/thread/13413?ContentTypeID=1</link><pubDate>Wed, 13 May 2015 19:35:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79b1a487-33a1-4612-a061-fd4f102d68e7</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;In #3, how do you propose to write to your array in flash when it&amp;#39;s declared as const?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device Name set question</title><link>https://devzone.nordicsemi.com/thread/13412?ContentTypeID=1</link><pubDate>Tue, 02 Sep 2014 15:15:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25804271-e782-4bf7-9fef-a37f7de31a6d</guid><dc:creator>Nikita</dc:creator><description>&lt;p&gt;Maybe like this?&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create array in flash that will contain your device name like &lt;a href="https://devzone.nordicsemi.com/question/16063/setting-address-of-variable-in-flash/?answer=16065#post-id-16065"&gt;this&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On power on set device name using sd_ble_gap_device_name_set() with this array.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On receiving device name change command over your custom service characteristic store received string in your array in flash.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set device name using sd_ble_gap_device_name_set() with this array.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;UPD:&lt;/p&gt;
&lt;p&gt;Though best is just using pstorage to store your data and update it with array in RAM as you aren&amp;#39;t restricted to use only const parameter, for example, this will work as well:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define DEVICE_NAME                        &amp;quot;My_device&amp;quot;

uint8_t arr[sizeof(DEVICE_NAME)];
strcpy((char *)arr, (const char *)DEVICE_NAME);

err_code = sd_ble_gap_device_name_set(&amp;amp;sec_mode,
                                      (const uint8_t *)arr,
                                      strlen((char *)arr));
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>