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

BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST write error 0x07 only for a particular range of value

Hi,

I am trying to write data to the nRF52 module from my custom application. I am sending few parameters bundled into a packet to the module. One of the parameters is the mV (milli volts) which is ranging from -2048 to +2048 (packed into 2 bytes of data). Issue i am having is that only for data between -30 to 0 mV, i am having this error: 

<error> app: ERROR 7 [NRF_ERROR_INVALID_PARAM]

This happens at sd_ble_gatts_rw_authorize_reply() function which is returning the above error code. Would you know what can be the cause of it? Why is it not happening over other range of values?

I am using the code from ble app uart example for BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event

case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:
{
    ble_gatts_evt_rw_authorize_request_t  req;
    ble_gatts_rw_authorize_reply_params_t auth_reply;

    req = p_ble_evt->evt.gatts_evt.params.authorize_request;

    if (req.type != BLE_GATTS_AUTHORIZE_TYPE_INVALID)
    {
        if ((req.request.write.op == BLE_GATTS_OP_PREP_WRITE_REQ)     ||
            (req.request.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) ||
            (req.request.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL))
        {
            if (req.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE)
            {
                auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE;
            }
            else
            {
                auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
            }
            auth_reply.params.write.gatt_status = APP_FEATURE_NOT_SUPPORTED;
            err_code = sd_ble_gatts_rw_authorize_reply(p_ble_evt->evt.gatts_evt.conn_handle,
                                                       &auth_reply);
            APP_ERROR_CHECK(err_code);
        }
    }
} break; // BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST

I am using nRF52832 module, SDK v14.2 and SD v5.0 for my development. 

Thank you.

  • Hello, 

    One of the parameters is the mV (milli volts) which is ranging from -2048 to +2048 (packed into 2 bytes of data).

    Could you elaborate on the parameters? What is the full range in mV that you are measuring? What other ranges do work? Does -100mV to -31mV work, and what is this equivalent to in bits?

    This happens at sd_ble_gatts_rw_authorize_reply() function which is returning the above error code.

     Can you please show/add more details around this function? How are you passing data to this function? Documentation is found here.

    Thank you!

    Kind regards,
    Øyvind

Related