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

Long write only writes 4 packets

Hello,

I'm implementing long write function to my project.

I managed to get it working, but i can't send more than 68 bytes of data. When i'm sending the data, I slice it into <18bytes chunks and send each chunk with correct offset, using "BLE_GATT_OP_PREP_WRITE_REQ" as sending type. When all the data is through i use this command to execute the write: "BLE_GATT_OP_EXEC_WRITE_REQ".

Now no matter how much i send (if it's more than 68 bytes), only 68 bytes come through. When i looked into what comes through i saw that only FIRST 4 packets are recieved, even thought i execute when all packets are sent.

Why are other packets lost?

Best regards, Nejc

Parents
  • Also, it is the sender that will see any errors. When you send a prepare write request, you get a BLE_GATTC_EVT_WRITE_RSP. All the GATTC events have a "gatt_status" flag that contains any error reported by the peer side. In this case, the peer knows that the queue is full, and responds autonomously.

  • You can use BLE_GATT_OP_WRITE_REQ or BLE_GATT_OP_WRITE_CMD. Write requests are limited the same way as prepare write requests, in that you have to wait for a response before you can send the next one. But the response will return with important error codes, like if the characteristic needs security. Write commands can be queued, and depending on your role and the SoftDevice, you can send up to 6 of them per connection interval. So they are much faster than other writes.

Reply
  • You can use BLE_GATT_OP_WRITE_REQ or BLE_GATT_OP_WRITE_CMD. Write requests are limited the same way as prepare write requests, in that you have to wait for a response before you can send the next one. But the response will return with important error codes, like if the characteristic needs security. Write commands can be queued, and depending on your role and the SoftDevice, you can send up to 6 of them per connection interval. So they are much faster than other writes.

Children
No Data
Related