Hello
I am using Android and BLE communication with nRF52832 (BLENano2) now.
I am using SDK 15.0.0 with keil uversion.
Central is Android and peripheral is nRF52832.
Use the SDK "ble_app_blinky".
I now want to send arbitrary data from peripheral to central.
By calling the following code "send_data" in the main for loop, it was possible to send the value to central.
uint32_t send_value(uint16_t conn_handle, ble_lbs_t * p_lbs, uint8_t sensor_value)
{
if (p_lbs == NULL)
{
return NRF_ERROR_NULL;
}
uint32_t err_code = NRF_SUCCESS;
ble_gatts_value_t gatts_value;
// Initialize value struct.
memset(&gatts_value, 0, sizeof(gatts_value));
gatts_value.len = sizeof(uint8_t);
gatts_value.offset = 0;
gatts_value.p_value = &sensor_value;
// Update database.
err_code = sd_ble_gatts_value_set(BLE_CONN_HANDLE_ALL,////////////
p_lbs->sensor_char_handles.value_handle,
&gatts_value);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Send value if connected and notifying.
if ((conn_handle != BLE_CONN_HANDLE_INVALID))
{
ble_gatts_hvx_params_t hvx_params;
memset(&hvx_params, 0, sizeof(hvx_params));
hvx_params.handle = p_lbs->sensor_char_handles.value_handle;
hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
hvx_params.offset = gatts_value.offset;
hvx_params.p_len = &gatts_value.len;
hvx_params.p_data = gatts_value.p_value;
err_code = sd_ble_gatts_hvx(conn_handle, &hvx_params);
}
else
{
err_code = NRF_ERROR_INVALID_STATE;
}
return err_code;
}
There is problem here.
I want to call this function every 8 ms (125 Hz) and send the value.
So I used nRFconnect to receive the value, but at 125 Hz the app processing won't catch up and the app will drop.
It seems that sending the value at 125 Hz is not a problem, but is it practically impossible to check the value on an iPhone or Android device?
When I searched for the frequency that the app does not fall, it will be around 50Hz.
Can't we do it faster?
Thank you.