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

BLE_GATTS_EVT_WRITE not reiceived

Dear all,

I'm using nRF52810 with nRF5_SDK_16.0.0_98a08e2 and s112_nrf52_7.0.1_softdevice

I've implemented a custom service which exposes 4 characteristics.

2 of them (names DEVICE_INFO and DATA) are defined the same way:

// Add the Device info Characteristic
memset(&add_char_params, 0, sizeof(add_char_params));
add_char_params.uuid                     = TXS_UUID_DEVICE_INFO;
add_char_params.uuid_type                = p_txs->uuid_type;
add_char_params.max_len                  = BLE_TXS_MAX_DATA_LEN;
add_char_params.init_len                 = 1;
add_char_params.is_var_len               = true;
add_char_params.is_value_user            = 1;
add_char_params.char_props.write         = 1;
add_char_params.char_props.write_wo_resp = 1;
add_char_params.char_props.notify        = 1;

add_char_params.read_access  = SEC_OPEN;
add_char_params.write_access = SEC_OPEN;
add_char_params.cccd_write_access = SEC_OPEN;    

err_code = characteristic_add(p_txs->service_handle, &add_char_params, &p_txs->devinfo_handles);
VERIFY_SUCCESS(err_code);

// Add the Data Characteristic
memset(&add_char_params, 0, sizeof(add_char_params));
add_char_params.uuid                     = TXS_UUID_DATA;
add_char_params.uuid_type                = p_txs->uuid_type;
add_char_params.init_len                 = 1;
add_char_params.is_var_len               = true;
add_char_params.is_value_user            = 1;
add_char_params.char_props.write         = 1;
add_char_params.char_props.write_wo_resp = 1;
add_char_params.char_props.notify        = 1;

add_char_params.read_access  = SEC_OPEN;
add_char_params.write_access = SEC_OPEN;
add_char_params.cccd_write_access = SEC_OPEN;    

err_code = characteristic_add(p_txs->service_handle, &add_char_params, &p_txs->data_handles);
VERIFY_SUCCESS(err_code);

When a client (Android with nRF Connect app) writes a value to the DEVICE_INFO characteristic, then on the device side, the BLE_GATTS_EVT_WRITE is triggered as expected. However, if the client writes a value to the DATA characteristics, then for some reason, there is no BLE event triggered on the device.

On the other hand, when the client set the CCCD to enable notifications on the DATA characteristic, then the BLE_GATTS_EVT_WRITE  is triggered as expected.

I don't understand what is going wrong since both characteristic have the same properties and are declared the same way, so why they don't have the same behaviour?

Any help is welcome Slight smile

Parents Reply Children
Related