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.

  • I see that I have misunderstood you a bit then. Yes, it is possible to use e.g. authorization to receive data written to a characteristic, and then manually writing it to an offset with sd_ble_gatts_value_set, but you would need to keep track of the offset and make sure the data goes to the correct place.

    Let's go back to the original issue at hand. Can you confirm that you send a prepare write request, the sd_ble_gattc_write call returns NRF_SUCCESS, and that you receive a BLE_GATTC_EVT_WRITE_RSP for each packet you send? And the evt->gattc_evt.gatt_status of all those events are BLE_GATT_STATUS_SUCCESS?

Reply
  • I see that I have misunderstood you a bit then. Yes, it is possible to use e.g. authorization to receive data written to a characteristic, and then manually writing it to an offset with sd_ble_gatts_value_set, but you would need to keep track of the offset and make sure the data goes to the correct place.

    Let's go back to the original issue at hand. Can you confirm that you send a prepare write request, the sd_ble_gattc_write call returns NRF_SUCCESS, and that you receive a BLE_GATTC_EVT_WRITE_RSP for each packet you send? And the evt->gattc_evt.gatt_status of all those events are BLE_GATT_STATUS_SUCCESS?

Children
No Data
Related