nRF52840 sending SAADC data over Bluetooth

Hi,

I'm currently doing a project where I want to sample an SAADC and send it over Bluetooth to another nRF52840 device with different sampling frequencies. The problem is that my sampling seems inconsistent from what I can see from my logs when I'm sending over Bluetooth. I'm using J-Link RTT Viewer with NRF_LOG_INFO() and I'm working with the NUS examples from the SDK 14.2.0. Here is what my logs show when I use a sampling of 1kHz without the ble_nus_send function (left value = time in ms, right value = ADC): 

When I'm uncommenting the ble_nus_send function, I'm getting this : 

It seems like the data is in group of 4 before sending. Since I don't want to lose any data, I'm sending only the ADC value with the ble_nus_send function in a "do while" loop.

Sender =>

#define SAMPLES_IN_BUFFER = 1;

#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(7.5, UNIT_1_25_MS)

#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(10, UNIT_1_25_MS) 

#define SLAVE_LATENCY                   0

#define CONN_SUP_TIMEOUT                MSEC_TO_UNITS(4000, UNIT_10_MS) 

#define ECHOBACK_BLE_UART_DATA  1

#define static uint16_t   m_ble_nus_max_data_len = BLE_GATT_ATT_MTU_DEFAULT - 3

 

Receiver =>

#define MIN_CONNECTION_INTERVAL MSEC_TO_UNITS(7.5, UNIT_1_25_MS)

#define MAX_CONNECTION_INTERVAL MSEC_TO_UNITS(10, UNIT_1_25_MS) 

#define SLAVE_LATENCY           0 

#define SUPERVISION_TIMEOUT     MSEC_TO_UNITS(4000, UNIT_10_MS)

#define m_ble_nus_max_data_len = BLE_GATT_ATT_MTU_DEFAULT - OPCODE_LENGTH - HANDLE_LENGTH;

Portion of code =>

do
{
    err_code2 = ble_nus_string_send(&m_nus, str, &m_buffer_temp_length);
} while(err_code2 != NRF_SUCCESS);


if(debug)
{
    ticks_debug = app_timer_cnt_get();
    ticks_debug = (int) ((ticks_debug * 1000) / 32768);
    NRF_LOG_INFO("%i %d", (int)ticks_debug, tab_values[0]);
}

Also, when I use a sampling frequency >=2kHz, it seems like some data aren't even sampled by the SAADC. I thought maybe the logs aren't showing fast enough and some lines are lost. I also tried to change some variables in the sdk_config without success.

Thank you for your help,

Keven