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

sd_ble_gattc_write and BLE_GATTC_EVT_WRITE_RSP problem

Hi all

I'm trying to send 180 bytes using sd_ble_gattc_write(). Writing 20 bytes at a time with the BLE_GATT_OP_WRITE_REQ write_op works. But now I'm trying to speed things up by sending packets of 18 bytes each with BLE_GATT_OP_PREP_WRITE_REQ and then execute it with BLE_GATT_OP_EXEC_WRITE_REQ . sd_ble_gattc_write does not return with an error . But the BLE_GATTC_EVT_WRITE_RSP event returns with gatt_status 0x0182. Can't find out what 0x0182 means. Any idea?

	write_params.handle = m_nus_rx_char_handle;
	write_params.flags = 0;
	write_params.len = 18;
	write_params.p_value = m_txPtr;
	write_params.write_op = BLE_GATT_OP_PREP_WRITE_REQ;
	write_params.offset = current_offset; // 0 for first call

	err_code = sd_ble_gattc_write(m_adapter, m_connection_handle, &write_params);
Parents
  • Hi,

    • What nRF device are you using? This is a central application?
    • What SDK version are you using?
    • Is this a custom board, or a DK ?

    Problem with the multiple writes is that there is only one packet of 20 bytes each connection interval.

    Only one packet per connection interval with indication, but multiple packets per connection interval if you use notification instead. If both sides of the link support it, you can increase the ATT MTU size, the default size of the ATT MTU is 23 bytes, but you can increase it to e.g. 247 bytes!

    With e.g. SoftDevice S132 version 3, you only had 6-7 packets per connection interval with notifications, but with the latest S132 version 5, you don’t have this limitation, and the SoftDevice is able to continue sending packets for the whole connection interval if both parts of the link supports it.

Reply
  • Hi,

    • What nRF device are you using? This is a central application?
    • What SDK version are you using?
    • Is this a custom board, or a DK ?

    Problem with the multiple writes is that there is only one packet of 20 bytes each connection interval.

    Only one packet per connection interval with indication, but multiple packets per connection interval if you use notification instead. If both sides of the link support it, you can increase the ATT MTU size, the default size of the ATT MTU is 23 bytes, but you can increase it to e.g. 247 bytes!

    With e.g. SoftDevice S132 version 3, you only had 6-7 packets per connection interval with notifications, but with the latest S132 version 5, you don’t have this limitation, and the SoftDevice is able to continue sending packets for the whole connection interval if both parts of the link supports it.

Children
No Data
Related