Cannot get ble characteristic with write_wo_resp to work

I need to update a characteristic to use write and write without response flags

I'm able to get this working on one of the characteristics but not the other

Running legacy nrf sdk 17.1

When I run this code, the ble characteristic shows up (on nrf Connect) as write only (with response required)

// Add the CMD Characteristic to SoftDevice.
    std::memset(&add_char_params, 0, sizeof(add_char_params));
    add_char_params.uuid                        = BLE_UUID_DATA_CMD_CHAR;
    add_char_params.uuid_type                   = p_dcs->uuid_type;
    add_char_params.max_len                     = BLE_DATA_MAX_CMD_CHAR_LEN;
    add_char_params.init_len                    = sizeof(uint8_t);
    add_char_params.is_var_len                  = true;

    add_char_params.char_props.write_wo_resp    = 1; // this should work

    // Write request
    add_char_params.char_props.write            = 1;

    // CMD characteristic has no authorization, no encryption and is not readable
    add_char_params.read_access                 = SEC_NO_ACCESS;

    // CMD characteristic is writable
    add_char_params.write_access                = SEC_OPEN;

    err_code                                    = characteristic_add(p_dcs->service_handle, &add_char_params, &p_dcs->cmd_handles);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }

When I run this code (different UUID) it works and nrf Connect shows it having write and write without response abilities

// Add the RCS_TX Characteristic to SoftDevice.  This characteristic will
    // receive data that will be written to the NRF52840 MCU.
    std::memset(&add_char_params, 0, sizeof(add_char_params));
    add_char_params.uuid                        = BLE_UUID_DATA_RCS_TX_CHAR;
    add_char_params.uuid_type                   = p_dcs->uuid_type;
    add_char_params.max_len                     = BLE_DATA_BLERCS_MAX_TX_CHAR_LEN;
    add_char_params.init_len                    = sizeof(uint8_t);
    add_char_params.is_var_len                  = true;

    // Write command
    add_char_params.char_props.write_wo_resp    = 1;

    // Write request
    add_char_params.char_props.write            = 1;

    // No BLE restrictions on access to characteristic, however the firmware
    // will disconnect unless the peer has authenticated.
    add_char_params.read_access                 = SEC_OPEN;
    add_char_params.write_access                = SEC_OPEN;

    err_code                                    = characteristic_add(p_dcs->service_handle, &add_char_params, &p_dcs->rcs_tx_handles);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }

Here is the nrf Connect output:

What am I doing wrong?

Parents Reply Children
No Data
Related