[SOLVED] Random errors when starting BLE GATT server
Posted: Mon Jun 04, 2018 5:27 pm
EDIT: in esp_ble_gatts_add_char, variable of type esp_attr_value_t must have an attr_len larger than 0.
Hi to all.
I made an example following the walkthrough example on gatt server which is found on Github.
Although it works properly (I mean, I can find my device on a BLE GATT scanner and read a value), some errors appeared through serial monitor. These errors are:
These errors are produced within this code:
Any ideas?
Thanks in advance.
Hi to all.
I made an example following the walkthrough example on gatt server which is found on Github.
Although it works properly (I mean, I can find my device on a BLE GATT scanner and read a value), some errors appeared through serial monitor. These errors are:
Code: Select all
CREATE_SERVICE_EVT, status 0, service_handle40
add char
E (784) BT: osi_mem_dbg_record invalid !!
E (784) BT: btc_gatts_arg_deep_copy 8 no mem
Service created successfully
E (794) BT: osi_mem_dbg_record invalid !!
ADD_CHAR_EVT, status 0, attr_handle 42, service_handle 40
E (794) BT: gatts_get_attribute_vaule failt:the value length is 0
Code: Select all
case ESP_GATTS_ADD_CHAR_EVT:{
uint16_t length = 0;
const uint8_t *prf_char;
printf("ADD_CHAR_EVT, status %d, attr_handle %d, service_handle %d\n",
param->add_char.status, param->add_char.attr_handle, param->add_char.service_handle);
nevera_profile.char_handler = param->add_char.attr_handle;
nevera_profile.descr_uuid.len = ESP_UUID_LEN_16;
nevera_profile.descr_uuid.uuid.uuid16 = ESP_GATT_UUID_CHAR_CLIENT_CONFIG;
esp_err_t get_attr_ret = esp_ble_gatts_get_attr_value(param->add_char.attr_handle, &length, &prf_char);
if(get_attr_ret == ESP_FAIL) printf("ILLEGAL HANDLE\n");
printf("the nevera char length =%x\n", length);
for(int i = 0; i < length; ++i)
printf("prf_char[%x] = %x\n", i, prf_char[i]);
esp_err_t add_descr_ret = esp_ble_gatts_add_char_descr(nevera_profile.service_handle, &nevera_profile.descr_uuid,
ESP_GATT_PERM_READ, NULL, NULL);
if(add_descr_ret)
printf("add char descr failed, error code: %x\n", add_descr_ret);
break;
}
Thanks in advance.