<?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>Reset chip on write</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/599/reset-chip-on-write</link><description>Hi, 
 How to reset the system whenever a particular write event is received from the BLE stack. I made some changes on the ble_app_hrs sample code as follows, 
 void ble_hrs_on_ble_evt(ble_hrs_t * p_hrs, ble_evt_t * p_ble_evt) 
 case BLE_GATTS_EVT_WRITE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Oct 2013 07:17:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/599/reset-chip-on-write" /><item><title>RE: Reset chip on write</title><link>https://devzone.nordicsemi.com/thread/3123?ContentTypeID=1</link><pubDate>Tue, 08 Oct 2013 07:17:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f055b3f-8eb9-4b31-806f-6f02b3f0f0c4</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;The sd_nvic_SystemReset() method is defined in nrf_soc.h, so if you want to use it from ble_hrs.c, you have to include that header file in the top of the source code file.&lt;/p&gt;
&lt;p&gt;To know which characteristic was written, you must look at the handle of the write event structure. This could for example look something like this, although it doesn&amp;#39;t make much sense as is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
    ble_gatts_evt_write_t * p_evt_write = &amp;amp;p_ble_evt-&amp;gt;evt.gatts_evt.params.write;
    
    if ((p_evt_write-&amp;gt;handle == p_your_service-&amp;gt;your_characteristic.value_handle) &amp;amp;&amp;amp;
             (p_evt_write-&amp;gt;data[0] == YOUR_SERVICE_RESET_COMMAND))
    {
        sd_nvic_SystemReset();
    }

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The handle used here should be the handle returned in the last parameter of sd_ble_gatts_characteristic_add().&lt;/p&gt;
&lt;p&gt;Edit: I also edited your question title to make it more clear what it is about. For information on how to modify the bootloader as you want, take a look at &lt;a href="https://devzone.nordicsemi.com/index.php/dfu#reply-1685"&gt;this question&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>