<?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>Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/37970/write-queued-characteristic-with-less-than-20-bytes</link><description>Good afternoon, 
 
 Following up my previous case, to which I got no reply, how can I use a queued write characteristic to write less than 20 bytes of data? 
 I&amp;#39;m using it to mainly write more than 20 bytes of data but when I write less than 20 bytes</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Oct 2018 13:28:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/37970/write-queued-characteristic-with-less-than-20-bytes" /><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/151680?ContentTypeID=1</link><pubDate>Thu, 04 Oct 2018 13:28:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65ac99d1-716b-43c5-9b01-748357c44302</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I think there are several projects you can look at. Not sure what is easiest, but there is the GLS project that has a protocol to transfer records. The ATT MTU throughput example is also set up to transfer larger amount of data. And there is our DFU solution.&lt;/p&gt;
&lt;p&gt;The easiest would probably be to set up something similar to the dfu solution. with one characteristic for data transfer and another one for control operations. start every packet with a length field, or maybe just packets that is divided across several MTU&amp;#39;s.&lt;/p&gt;
&lt;p&gt;Thinking about it, you could have an ekstra characteristic as a control point that you use to notify the peer in case you are sending more than one MTU, and possibly to confirming crc across these packets. so if you are sending only one MTU (MTU size can be configured), you are not doing any additional work. But in case you are sending more data you notify the peer how many packets to expect, and do a crc confirm.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/150538?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2018 16:12:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69b623df-cfde-489d-8724-cfe937ebd3e0</guid><dc:creator>jloliveira</dc:creator><description>&lt;p&gt;Hi Runar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I understand your proposal, but since I&amp;#39;m considering a characteristic with variable length, from 10bytes to 1024, I would have to create a protocol that would communicate the number of bytes being transmitted&amp;nbsp;in every transaction,&amp;nbsp;besides the actual data.&lt;/p&gt;
&lt;p&gt;Do you have any proposal or example to workout such variable length characteristic up to 1024bytes?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Jo&amp;atilde;o&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/150492?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2018 13:00:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc34230a-18d6-4e23-8d9b-abf4ad4e5aa3</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Not really. But you could consider storing the data in your application instead and use the characteristic only as a means of transportation. I think that is a more common way of handling this, instead of using QWR.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/150447?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2018 10:54:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e95bf24f-4a78-4e22-87be-6cd56cb73e13</guid><dc:creator>jloliveira</dc:creator><description>&lt;p&gt;Dear Runar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But is there any other means besides QWR to write more than 510bytes through a characteristic?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Jo&amp;atilde;o&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/149843?ContentTypeID=1</link><pubDate>Fri, 21 Sep 2018 13:09:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9f8192a-3a6f-4322-a84a-654672a5087f</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Unfortunately, the Softdevice limits this:&lt;/p&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td align="right" colspan="1" rowspan="1" valign="top"&gt;#define&amp;nbsp;&lt;/td&gt;
&lt;td colspan="1" rowspan="1" valign="bottom"&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_t_t_s___a_t_t_r___l_e_n_s___m_a_x.html#ga4cf6efe8134f1f771c088ff7d4c1d79a"&gt;BLE_GATTS_FIX_ATTR_LEN_MAX&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;(510)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan="2" rowspan="1"&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align="right" colspan="1" rowspan="1" valign="top"&gt;#define&amp;nbsp;&lt;/td&gt;
&lt;td colspan="1" rowspan="1" valign="bottom"&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_t_t_s___a_t_t_r___l_e_n_s___m_a_x.html#gac2a12a8c74733f8a666083550b77dc09"&gt;BLE_GATTS_VAR_ATTR_LEN_MAX&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;(512)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/149104?ContentTypeID=1</link><pubDate>Mon, 17 Sep 2018 17:25:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:831bafc8-3049-4d93-b5a6-131dd7f373e0</guid><dc:creator>jloliveira</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi again&amp;nbsp;&lt;/span&gt;&lt;span&gt;Bj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For writing more than&amp;nbsp;510bytes to a characteristic I mean writing up to 1024bytes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you again,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jo&amp;atilde;o&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/149103?ContentTypeID=1</link><pubDate>Mon, 17 Sep 2018 17:22:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60841850-e46b-4d1d-bbee-c190cc927aa1</guid><dc:creator>jloliveira</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Bj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your reply.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Just updated the&amp;nbsp;&lt;span&gt;QWR and QWRS files and now the queued write is working like a charm for less than 20bytes.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;As a last question, is there a way to write more than 510bytes to a characteristic, with QWR or by any other means?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Thank you,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Jo&amp;atilde;o&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/148451?ContentTypeID=1</link><pubDate>Wed, 12 Sep 2018 14:29:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb593011-06a8-41fc-896a-674e564a09d8</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi João,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;please find the QWR and QWRS source and header files with the necessary changes to receive less than 20bytes and propagating this to the application. The only changes in main.c should be the addition of&amp;nbsp;NRF_LOG_HEXDUMP_INFO(&amp;amp;p_evt-&amp;gt;rcvd_data,p_evt-&amp;gt;rcv_length) to the&amp;nbsp;BLE_QWRS_NEW_DATA_RCVD case in&amp;nbsp;queued_write_example_service_evt_handler, i.e.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;     case BLE_QWRS_NEW_DATA_RCVD:
            NRF_LOG_INFO(&amp;quot;BLE_QWRS_NEW_DATA_RCVD&amp;quot;);
            NRF_LOG_HEXDUMP_INFO(&amp;amp;p_evt-&amp;gt;rcvd_data,p_evt-&amp;gt;rcv_length);
            // This is where the data is actually received and has been accepted.
            break;//BLE_QWRS_NEW_DATA_RCVD&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Attachments:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-0c5a7638813842f7bd3adfe13b217791/nrf_5F00_ble_5F00_qwrs.c"&gt;devzone.nordicsemi.com/.../nrf_5F00_ble_5F00_qwrs.c&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-0c5a7638813842f7bd3adfe13b217791/nrf_5F00_ble_5F00_qwrs.h"&gt;devzone.nordicsemi.com/.../nrf_5F00_ble_5F00_qwrs.h&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-0c5a7638813842f7bd3adfe13b217791/nrf_5F00_ble_5F00_qwr.h"&gt;devzone.nordicsemi.com/.../nrf_5F00_ble_5F00_qwr.h&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-0c5a7638813842f7bd3adfe13b217791/nrf_5F00_ble_5F00_qwr.c"&gt;devzone.nordicsemi.com/.../nrf_5F00_ble_5F00_qwr.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/147653?ContentTypeID=1</link><pubDate>Thu, 06 Sep 2018 15:27:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:653d0a06-0bb3-460f-9ae5-dab79f6b1331</guid><dc:creator>jloliveira</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Bj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your reply.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I understand the clarified implications.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Our peripheral is intended to interact with Smartphone central apps on both Android and iOS, and we make use of multiple services/characteristics along with the Queued Write Service and its containing Queued Write Characteristic. We can write either less or more than 20 bytes through&amp;nbsp;the&amp;nbsp;Queued Write Characteristic. So what would be the best way to solve this issue? Is there a way to force a &amp;quot;Prepare Write Request&amp;quot; through the Smartphone central app on both Android and iOS or should we change the nrf_ble_qwr/nrf_ble_qwrs events to deal with both types of data lengths? For the suggested solution, what exactly should we code?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Looking forward to your reply,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jo&amp;atilde;o&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/147642?ContentTypeID=1</link><pubDate>Thu, 06 Sep 2018 14:49:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9302e5ca-f351-452d-87d4-e10349731cdf</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;HI Joao,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve been looking a bit more into the QWR module code and looking at a sniffer trace when you write less than 20bytes to the QWR characteristic.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So if you write less than 20 bytes to the QWR characteristic using nRF Connect for Android/iOS or Desktop, then it will send a regular&lt;strong&gt; Write Request&lt;/strong&gt; that needs to be authorized and not a&lt;strong&gt; Prepare Write Request&lt;/strong&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The code I sent you in my previous reply modifies the QWR event handler to handle a Write Request, but the Write Request is not preceeded by a User Memory Request, the SD is asking the Application for a memory section to store the incoming data in, so invoking the&amp;nbsp;nrf_ble_qwrs_on_qwr_evt() handler&amp;nbsp;and passing NRF_BLE_QWR_EVT_EXECUTE_WRITE as the event type is not possible as it will trigger the&amp;nbsp;nrf_ble_qwr_value_get() call, which in turn will try to use a buffer that is never allocated&lt;br /&gt;&lt;br /&gt;So I am not sure if it is the right way to go as the module would work as it should if the less than 20 byte data is sent as a prepare write request followed by an Execute Write Now Request.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You could of course create a separate event type&amp;nbsp;NRF_BLE_QWR_EVT_WRITE_REQ and then handle that in&amp;nbsp;&lt;span&gt;nrf_ble_qwrs_on_qwr_evt(), but then you would have to modify the&amp;nbsp;nrf_ble_qwrs_on_qwr_evt() handler so that&amp;nbsp;nrf_ble_qwr_value_get() is not called when the&amp;nbsp;NRF_BLE_QWR_EVT_WRITE_REQ&amp;nbsp;event is received.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What is your use case for queued writes, are you planning on writing to multiple characteristic handles or is it just one characteristic handle? Also what are you planning on using as the central device, a smartphone or another nordic device?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Bjørn&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/147433?ContentTypeID=1</link><pubDate>Wed, 05 Sep 2018 16:26:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61713390-df77-4c18-967b-2881e45c352d</guid><dc:creator>jloliveira</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Bj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your reply.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Indeed now it doesn&amp;#39;t halt when writing less than 20 bytes, still the write request is not executed in the end, which indicates&amp;nbsp;that something is still missing to forward the write command and respective data to execution.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Looking forward to your reply,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jo&amp;atilde;o&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/147422?ContentTypeID=1</link><pubDate>Wed, 05 Sep 2018 15:17:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9c50d61-5f0e-4d8c-9876-0d0034059f02</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;HI Joao,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I sincerely apologize for the very late reply on this question and the other QWR related question you have posted. I&amp;#39;ve been looking at the QWR module and it appears that it does not handle regular write requests with authorization, i.e. it is not replying to a write auth. request and that is why it is hanging. I added the following code to the switch-case in&amp;nbsp;on_rw_authorize_request() in nrf_ble_qwr.c&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    case BLE_GATTS_OP_WRITE_REQ:
            auth_reply.type                     = BLE_GATTS_AUTHORIZE_TYPE_WRITE;
            auth_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS;
            auth_reply.params.write.update = 1;
            ret_code_t err_code = sd_ble_gatts_rw_authorize_reply(p_qwr-&amp;gt;conn_handle,&amp;amp;auth_reply);
            if (err_code != NRF_SUCCESS)
            {
                // Report error to application.
                p_qwr-&amp;gt;error_handler(err_code);
            }
            break;&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This appears to solve the issue of the application halting when writing less than 20 bytes. I will look more into this tomorrow.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Bjørn&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write Queued Characteristic with Less than 20 bytes</title><link>https://devzone.nordicsemi.com/thread/146373?ContentTypeID=1</link><pubDate>Wed, 29 Aug 2018 16:09:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e02c8bc1-f38c-4584-ae79-50ff676553b6</guid><dc:creator>jloliveira</dc:creator><description>&lt;p&gt;I&amp;#39;m running a peripheral BLE device using&amp;nbsp;SDK15 and Softdevice6.0.0&lt;/p&gt;
&lt;p&gt;Thank you again,&lt;/p&gt;
&lt;p&gt;Jo&amp;atilde;o&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>