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

gatt_init procedure prevents long write SDK14.2

Hello,

I need to long WRITE AND long READ from a central/client (android) to a peripheral server (nrf52). when I says long it means longer than the MTU.

LONG READ

I made my long read successful by changing the MTU using the GATT procedure and specifying the variable NRF_SDH_BLE_GATT_MAX_MTU_SIZE = 247

/**@brief Function for initializing the GATT library. */
void BleApp::gatt_init(void) {
	ret_code_t err_code;

	err_code = nrf_ble_gatt_init(&m_gatt, on_gatt_evt);
	APP_ERROR_CHECK(err_code);

	err_code = nrf_ble_gatt_att_mtu_periph_set(&m_gatt,
	NRF_SDH_BLE_GATT_MAX_MTU_SIZE);         // UPDATE MTU HERE
	APP_ERROR_CHECK(err_code);

	NRF_LOG_DEBUG("[INIT] GATT");
}

LONG WRITE

I made my long write successful by using the queued write sequence:

1) BLE_EVT_USER_MEM_REQUEST

2.1) BLE_GATTS_OP_WRITE_REQ

....

2.n) BLE_GATTS_OP_WRITE_REQ

3) BLE_GATTS_OP_EXEC_WRITE_REQ_NOW

4) BLE_EVT_USER_MEM_RELEASE

But it works only if:

  1. The MTU is not changed (20 bytes), which is a problem because I need it for read
  2. The packet is not too big. If more than (approx) 100B, I receive only the mem_request and the mem_release

someone can give me a hint ? I m' sotcked 

thanks,

yacine

Parents Reply Children
No Data
Related