<?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>How to do a write request on a 20 bytes characteristic?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49992/how-to-do-a-write-request-on-a-20-bytes-characteristic</link><description>Hi, 
 
 I have a problem when I do a write request on a 20 bytes characteristic from a custom service. 
 The funtion sd_ble_gattc_write return error 0x7 but I can&amp;#39;t find what it means. 
 
 I found out that the write request work when I only write 1, 2</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Jul 2019 12:07:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49992/how-to-do-a-write-request-on-a-20-bytes-characteristic" /><item><title>RE: How to do a write request on a 20 bytes characteristic?</title><link>https://devzone.nordicsemi.com/thread/199772?ContentTypeID=1</link><pubDate>Mon, 22 Jul 2019 12:07:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:308e264e-5364-4756-bf24-5f398579a1a3</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The error was coming from the fact the write request was configured for the write of the CCCD.&lt;/p&gt;
&lt;p&gt;I had this :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1563797111377v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1563797139906v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;So there was problems when I tried to put a 20 bytes value in gattc_value.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now I have this and it work :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1563797238891v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your help Havard.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to do a write request on a 20 bytes characteristic?</title><link>https://devzone.nordicsemi.com/thread/199585?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2019 16:13:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3046cf3-1998-45fa-b03d-26dc3650764f</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;Well, that certainly looks like error code 7 (NRF_ERROR_INVALID_PARAM).&lt;/p&gt;
&lt;p&gt;It&amp;#39;s hard from looking at these screenshots what happened to your variables. I would preferably step in the code with a debugger, or like you are doing, add more prints to figure out if you have any problems with pointers or scope of your variables.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to do a write request on a 20 bytes characteristic?</title><link>https://devzone.nordicsemi.com/thread/199548?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2019 13:19:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:faea5228-cbc2-46a6-a279-506a108da404</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;Hi Havard,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried to write the characteristic with nrf connect and it worked.&lt;/p&gt;
&lt;p&gt;I added logs in tx_buffer_process() so we can see what is happenning :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1563541941557v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;It gave me this result :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1563542027213v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Here we can see the value I wented to write (05 00 33 79 81 02 36 11 11 11 11 11 11 11 11 01 00 00 00 00) and then we the variables used in&amp;nbsp;&lt;span&gt;sd_ble_gattc_write()&amp;nbsp;. All the variables except the conn_handle are different than what I was&amp;nbsp;expecting.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to do a write request on a 20 bytes characteristic?</title><link>https://devzone.nordicsemi.com/thread/199345?ContentTypeID=1</link><pubDate>Thu, 18 Jul 2019 15:42:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09701866-715e-4e65-be2e-49f70674fde3</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Sounds cryptic that you can write 4 bytes but not more. In fact, vlen = 0 means that the length of the &lt;span&gt;characteristic&lt;/span&gt; should always be 20 (CONCENTRATOR_FRAME_SIZE). In the &amp;quot;write&amp;quot; screenshot above I see that you are using&amp;nbsp;&lt;span&gt;CONCENTRATOR_FRAME_SIZE so if that is 20 then it should be fine.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Could you&amp;nbsp;run the project in debug mode, and post the state of the variables just as you are calling&amp;nbsp;sd_ble_gattc_write() from the central?&lt;/p&gt;
&lt;p&gt;It may give us some useful clues.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1563463654278v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Have you tried writing to this characteristic from other sources (nRF Connect for PC or mobile?) I just want to confirm that&amp;nbsp;the problem is on the client-side&amp;nbsp;where you are seeing the error code (and not the server-side).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>