Hello i am trying to send 4 bytes of data over ble with custom service but im getting an unknown error and i am stuck in a dead end please help me .I am greatfull to any kind of help .
this is my main function
int main(void)
{
uint8_t Falll;
uint8_t temp_value;
uint8_t hum_value;
uint32_t pres_value;
bool erase_bonds;
I2C_init();
BME280_Turn_On();
NRF_LOG_INFO("bme280 open.");
mpu6050_init();
NRF_LOG_INFO("mpu6050 open");
// Initialize.
log_init();
timers_init();
buttons_leds_init(&erase_bonds);
power_management_init();
ble_stack_init();
gap_params_init();
gatt_init();
services_init();
advertising_init();
conn_params_init();
peer_manager_init();
application_timers_start();
advertising_start(erase_bonds);
// Enter main loop.
for (;;)
{
// idle_state_handle();
nrf_delay_ms(500);
Falll = MPU6050_FallDet();
temp_value=BME280_Temp_value();
NRF_LOG_INFO("TEMP value = %d ", temp_value);
NRF_LOG_FLUSH();
pres_value=BME280_Pres_value();
NRF_LOG_INFO("PRES value = %d ", pres_value);
NRF_LOG_FLUSH();
hum_value=BME280_Hum_value();
NRF_LOG_INFO("HUM value = %d ", hum_value);
NRF_LOG_FLUSH();
if(m_conn_handle != NULL ) {
pres_value_update(pres_value);
temp_value_update(temp_value);
hum_value_update(hum_value);
fall_value_update(Falll);
}
}
}
<error> app: ERROR 536883716 [Unknown error code] at C:\Users\HP\Desktop\nrf_sdk_17\nRF5_SDK_17.0.0_9d13099\examples\MY PROJECT\ble_app_deneme\main.c:181 PC at: 0x0002BFB7 <error> app: End of error report
at 181 i have this
static void pres_value_update(presvalue)
{
ret_code_t err_code;
err_code = ble_cus_pres_level_update(&m_cus, presvalue , m_conn_handle);
if(err_code != NRF_SUCCESS &&
err_code != NRF_ERROR_INVALID_STATE &&
err_code != NRF_ERROR_RESOURCES &&
err_code != NRF_ERROR_BUSY &&
err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING)
{
APP_ERROR_CHECK(err_code);
}
}
this is my update function
uint32_t ble_cus_pres_level_update(ble_cus_t * p_cus, uint32_t presvalue, uint16_t conn_handle)
{
if (p_cus->conn_handle != BLE_CONN_HANDLE_INVALID)
{
ble_gatts_hvx_params_t params;
uint16_t len = sizeof(presvalue);
memset(¶ms, 0, sizeof(params));
params.type = BLE_GATT_HVX_NOTIFICATION;
params.handle = p_cus->bme280_presvalue_char_handles.value_handle;
params.p_data = (uint8_t*)presvalue;
params.p_len = &len;
return sd_ble_gatts_hvx(p_cus->conn_handle, ¶ms);
}
}
this is my character add function
uint8_t bme280_pres_char_init_value [4] = {0};
memset(&add_char_params, 0, sizeof(add_char_params));
add_char_params.uuid = BME280_PRESVALUE_CHAR_UUID;
add_char_params.uuid_type = p_cus->uuid_type;
add_char_params.init_len = 4;
add_char_params.max_len = 4;
add_char_params.p_init_value = bme280_pres_char_init_value;
add_char_params.char_props.read = 1;
add_char_params.char_props.notify = 1;
add_char_params.read_access = SEC_OPEN;
add_char_params.cccd_write_access = SEC_OPEN;
err_code = characteristic_add(p_cus->service_handle,
&add_char_params,
&p_cus->bme280_presvalue_char_handles);
if (err_code != NRF_SUCCESS)
{
return err_code;
}