Hello everyone,
I am doing a project in which a nRF58122 is getting data of an accelerometer and an ADC. Those can be set a really high frequencies. The problem is, when I want to send the information through BLE to an android device. I send notifications of two characteristics (one 6 bytes and the other one 2 bytes).
If I take, for example, a frequency data rate of 20 Hz, I lose lots of packets. Is it normal? Which should be the maximum notification frequency before beginning to lose packets?
This is some code I use for the notification. This timer handler is called every time I want o send the notification again, for example every 0.05s (at 20Hz).
void timer_iforce_handler(void * p_context)
{
UNUSED_PARAMETER(p_context);
uint16_t len;
// Accelerometre notification
len=6;
readAccelData();
//Notification
ble_gatts_hvx_params_t hvx_params;
memset(&hvx_params, 0, sizeof(hvx_params));
hvx_params.handle = m_iforce.iforce_accelerometer_handles.value_handle;
hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
hvx_params.offset = 0;
hvx_params.p_len = &len;
hvx_params.p_data = accelData;
sd_ble_gatts_hvx(m_zipconfig.conn_handle, &hvx_params);
// ADC notification
len=2;
ADS1120_check_and_read();
//Notification
memset(&hvx_params, 0, sizeof(hvx_params));
hvx_params.handle = m_iforce.iforce_straingauge_handles.value_handle;
hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
hvx_params.offset = 0;
hvx_params.p_len = &len;
hvx_params.p_data = rx_buffer;
sd_ble_gatts_hvx(m_zipconfig.conn_handle, &hvx_params);
}
Thank you very much!