This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Queued write module

Hi,

I configured nrf_ble_qwr to use 256 byte long buffer in my BLE peripheral. I registered my value handles (2) which I want to support long writes using nrf_ble_qwr_attr_register. I set NRF_BLE_QWR_MAX_ATTR = 2. On connected event I assign connection handle using nrf_ble_qwr_conn_handle_assign.

Still, I don't receive any event from nrf_ble_qwr in my callback (qwr_init.callback).

When I perform long write of total size less than 256 bytes from BLE central to my peripheral, nrf_ble_qwr module receives BLE_EVT_USER_MEM_REQUEST and after that  BLE_EVT_USER_MEM_RELEASE events and no event is propagated to my application.

How to use nrf_ble_qwr? I saw examples\ble_peripheral\experimental\ble_app_queued_writes .I use latest SDK.

Parents
  • Hi,

    The example you refer to, the Queued Writes Application, is probably the best example for seeing the Queued write module in use. However, I did not understand why you want to use the queued writes module?

    Just so there are no misunderstandings I want to emphasize that queued writes only make sense if you want to synchronize writes to multiple characteristics, so that the change take effect simultaneously. If you just want to write to a long characteristic and have to split it over multiple writes, then you should write with offset instead. That is simpler and has less overhead.

  • Thanks. I have BLE central that splits long data to several chunks and then writes it to my characteristics using several "prepare write requests" (it sets offset and length of current chunk) and then it executes "execute write request". Am I going to receive this data using Queued write module or how in SDK 15?

  • If you have a requirement to use queued write because you cannot control the central, then yes, you can use the queued write module. But the scenario you describe where you just need to split long data in several chunks is not a good use case for queued writes (it is simply overcomplicated, since it is designed for a different and more complex use case), so if you can change the central to avoid it that would probably be the best.

    If you decide to stick with queued writes, you can refer to the queued writes module documentation in addition to the example.

  • Unfortunately I can't modify the central.

    I read documentation but still I'm not able to receive the data. Documentation states that on execute write command from central we receive NRF_BLE_QWR_EVT_AUTH_REQUEST event in nrf52 peripheral. However I never receive it. I set breakpoint in nrf_ble_qwr.c, function on_rw_authorize_request. It never hits this function.

    I'm migrating nrf51 project that used old SDK to nrf52832 SDK 15. Old project worked regarding queued writes - I passed my buffer to softdevice on BLE_EVT_USER_MEM_REQUEST using sd_ble_user_mem_reply() and then on BLE_GATTS_EVT_WRITE (when p_evt_write->op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) I read received data from the buffer.

  • I discovered that on execute write command from central I receive BLE_GATTS_EVT_WRITE with p_evt_write->op ==  BLE_GATTS_OP_EXEC_WRITE_REQ_NOW. This is not handled by nrf_ble_qwr. I probably doesn't understand what is the purpose of nrw_ble_qwr module and if I should use it.

Reply Children
Related