Im' trying to send a set of 80 bytes using indication. for that I have a characteristic sending each time 20 bytes and wait for indication acknowledgement before sending the next 20 bytes. but then sometimes I reveive only 3 frame on nrf side (I always miss the first one).
I'm using SEGGER_RTT to debug, and each time, it print 4 times the return value of ble__param_update
which is always 0, which means that it successfully sent 4 frames. also I didnt experience any timeout.
do {
err_code = ble__param_update(STEP_CURVE, buffer); /* update data on BLE */
SEGGER_RTT_printf(0,"error code is %d \n",err_code);
} while (err_code == BLE_ERROR_NO_TX_BUFFERS);
/* waiting or acknowledgement */
flash_context.indication_timeout = 0; // incremented every 10 ms by a timer
while (accelerometer_context.curve_indications_pending) {
app_sched_execute();
nrf_delay_ms(25);
/* time out : disconnect and try next time */
if ((flash_context.indication_timeout >= 200) || (err_code == NRF_ERROR_INVALID_STATE)) {
disconnected = true;
break;
}
}*
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
....
case BLE_GATTS_EVT_HVC:
/* indications received from curve characteristic */
if (p_ble_evt->evt.gatts_evt.params.hvc.handle == m.step_curve_char_handles.value_handle) {
accelerometer_context.curve_indications_pending = false;
}
break;
....
}
by using the sniffer and wireshark I can see 4 indication received but nrf on all android devices recieve only 3 !!!