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

sd_ble_gatts_hvx() always send data from 0x00 address

Hello, I have a problem with Indicate Characteristic. When I try to send data using sd_ble_gatts_hvx() function, it always sends 20bytes from address 0x00. This is my code for sending data:

        uint16_t               hvx_len;
    ble_gatts_hvx_params_t hvx_params;
		
    memset(&hvx_params, 0, sizeof(hvx_params));
			
			hvx_len = 20;
		
    hvx_params.handle = p_dt->tx_handles.value_handle;
    hvx_params.type   = BLE_GATT_HVX_INDICATION;
    hvx_params.offset = 0;
    hvx_params.p_len  = &hvx_len;
    hvx_params.p_data = data
    
    err_code = sd_ble_gatts_hvx(p_dt->conn_handle, &hvx_params);

err_code is 0. 'data' is pointer to data buffer. In debugger, I chech hvx_params struct, it contains proper data. And this is code to setting up Characteristic Value:

attr_char_value.p_uuid       = &ble_uuid;
attr_char_value.p_attr_md    = &attr_md;
attr_char_value.init_len     = 20;
attr_char_value.init_offs    = 0;
attr_char_value.max_len      = 0;
attr_char_value.p_value      = NULL;

What could be wrong?

Related