<?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>P_evt_write handle doesn&amp;#39;t match</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25531/p_evt_write-handle-doesn-t-match</link><description>Hi, 
 I have a basic characteristic on which I would like to write. I did this on so many projects without any problem but here, the value handle of my characteristic doesn&amp;#39;t match with the expected one. 
 static void on_write(ble_acs_t * p_acs, ble_evt_t</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 Sep 2017 13:04:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25531/p_evt_write-handle-doesn-t-match" /><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100662?ContentTypeID=1</link><pubDate>Fri, 29 Sep 2017 13:04:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:366ceaf7-ad64-40c2-b26a-3d80b72d4c3c</guid><dc:creator>julienh</dc:creator><description>&lt;p&gt;Peter founds the issue. That was a corruption of the RAM due to the fact that I added more value in an array than the actual size of this one.&lt;/p&gt;
&lt;p&gt;Working fine now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100657?ContentTypeID=1</link><pubDate>Fri, 29 Sep 2017 08:59:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df1da429-37a8-4836-b484-ad9b770d0b04</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Please send me the hex file of your program.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100655?ContentTypeID=1</link><pubDate>Fri, 29 Sep 2017 08:55:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d163cd0a-0e22-4afe-a719-d3a037898816</guid><dc:creator>julienh</dc:creator><description>&lt;p&gt;We have exactely the same code.
Do you think that this is possible that something is corrupted in my SDK files or my IDE? I don&amp;#39;t know what to do...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100661?ContentTypeID=1</link><pubDate>Fri, 29 Sep 2017 08:51:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0ce4a6f-22cc-4899-996b-61e3af4d493a</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Yes I tried that. I always get 24/24.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100656?ContentTypeID=1</link><pubDate>Fri, 29 Sep 2017 08:27:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6bd6ce4-1244-4e89-9bd4-db3f4e6ae364</guid><dc:creator>julienh</dc:creator><description>&lt;p&gt;In fact it seems to be a biggest problem that what I thought. When I try to update a value with sd_ble_gatts_value_set, somtimes it&amp;#39;s ok and sometimes error 0x05.&lt;/p&gt;
&lt;p&gt;err_code = sd_ble_gatts_value_set(p_acs-&amp;gt;conn_handle,
p_acs-&amp;gt;accumulated_steps_handles.value_handle,
&amp;amp;gatts_value);&lt;/p&gt;
&lt;p&gt;Sometimes I have p_acs conn handle 0 and  p_acs-&amp;gt;accumulated_steps_handles.value_handle 18 (success) and sometimes I have p_acs conn handle 0 and  p_acs-&amp;gt;accumulated_steps_handles.value_handle 349 (error).&lt;/p&gt;
&lt;p&gt;As explained before, it seems to be random when I connect / disconnect the device multiple times. I&amp;#39;m using nRF connect on Android phone for information.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100654?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2017 22:10:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c2f8d29-4006-484e-bd37-b1c6d6e223b0</guid><dc:creator>julienh</dc:creator><description>&lt;p&gt;Petter, did you try many connection / disconnection? Because I did a lot of connection / disconnection and somtimes I have 24 / 24 and sometimes I don&amp;#39;t have the same value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100660?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2017 16:41:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1527db3c-2dd9-4d78-9111-e1408b546c08</guid><dc:creator>julienh</dc:creator><description>&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Capture-decran-2017_2D00_09_2D00_28-a-18.36.28.png" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your fast reply. tested again with exactly the same code that I sent you and not the same result as you. You can see in the attached screenshot.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m just writing a value on characteristic 0x0503 with nRF Connect (Android phone).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100659?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2017 15:24:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c42a8afa-a83a-4cc8-9075-884dd7663e09</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;0x18 or 24 is the correct handle for p_acs-&amp;gt;reset_handles.value_handle()&lt;/p&gt;
&lt;p&gt;I tried to debug the project here, and I get 0x18 for both.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0x18.png" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100658?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2017 13:47:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fece3e2-94e1-453c-886f-9c129021d37a</guid><dc:creator>julienh</dc:creator><description>&lt;p&gt;Done (ps : the user name is different -&amp;gt; julienhmt).&lt;/p&gt;
&lt;p&gt;Thank you for your help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100651?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2017 13:36:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45d71b00-febf-4f5b-91f1-688ab4e4921e</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Yes please :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100652?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2017 13:33:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e688d89d-b6c3-4f24-87fc-69e7c985101c</guid><dc:creator>julienh</dc:creator><description>&lt;p&gt;Hi Petter,&lt;/p&gt;
&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m checking that this is a GATTS_EVT_WRITE before sending to my on_write function which is called.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void ble_acs_on_ble_evt(ble_acs_t * p_acs, ble_evt_t * p_ble_evt)
{
  if ((p_acs == NULL) || (p_ble_evt == NULL)) {
    return;
  }

  switch (p_ble_evt-&amp;gt;header.evt_id) {
  case BLE_GAP_EVT_CONNECTED:
    on_connect(p_acs, p_ble_evt);
    break;

  case BLE_GAP_EVT_DISCONNECTED:
    on_disconnect(p_acs, p_ble_evt);
    break;

  case BLE_GATTS_EVT_WRITE:
  on_write(p_acs, p_ble_evt);
  break;

  default:
    // No implementation needed.
    break;
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Everything seems to be good to me on ble_evt_dispatch.&lt;/p&gt;
&lt;p&gt;I will create a case and send you the whole project. Tha will be simpler do discuss.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: P_evt_write handle doesn't match</title><link>https://devzone.nordicsemi.com/thread/100653?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2017 10:01:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7617794a-936d-4062-a42e-d90f3fc329cd</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Sounds strange that p_evt_write-&amp;gt;handle is 24 when you 1 service and 3 characteristics, but what handle do you expect? The only thing I can think of straight away is that this is not actually a write event, but some other event, you could double check that p_ble_evt-&amp;gt;header.evt_id is actually BLE_GATTS_EVT_WRITE.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure why p_acs-&amp;gt;reset_handles.value_handle is 117 either, but as you say it sounds incorrect. But this is forwarded from main.c isn&amp;#39;t it? You have something like ble_acs_on_ble_evt(&amp;amp;m_acs, p_ble_evt); in ble_evt_dispatch() in main? Are you sure the handle is actually set? It is typically set in services_init(). Have you checked the value of p_acs-&amp;gt;reset_handles.value_handle after it is called? If it is 117 I guess you have found the culprit. If not, you should check why this is set to 117 at a later time in your program.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>