This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52 DK number of packets sent/received.

Ok, so I am using nRF52DK and trying to figure out to how to send up to 6 packets of data from custom service that sends 6 16bit values per packet. When I send one packet at a time everything is working ok. Once I call send 6 times in a row, I only see 5 packets arrive the first time and 4 packets all consecutive times. I am using nRF Connect app for android to see and communicate with the chip. 

Here is code where I call send command, that is timer driven:

static void imu_meas_timeout_handler(void * p_context)
{
    ret_code_t      err_code;
    ble_imus_meas_t  imus_measurement;

    UNUSED_PARAMETER(p_context);

    imus_measurement.accel_x = 2000;
    imus_measurement.accel_y = 1500;
    imus_measurement.accel_z = 1200;
    imus_measurement.gyro_x = 2500;
    imus_measurement.gyro_y = 1700;
    imus_measurement.gyro_z = 1000;
    
    err_code = ble_imus_measurement_send(&m_imus, &imus_measurement);
    err_code = ble_imus_measurement_send(&m_imus, &imus_measurement);
    err_code = ble_imus_measurement_send(&m_imus, &imus_measurement);
    err_code = ble_imus_measurement_send(&m_imus, &imus_measurement);
    err_code = ble_imus_measurement_send(&m_imus, &imus_measurement);
    err_code = ble_imus_measurement_send(&m_imus, &imus_measurement);
    
    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_HANDLER(err_code);
    }
}

I have searched on how I can increase amount of data sent but everything that I have tried does not help me. If I reduce amount of data being send to lets say 1 value I see 6 packets come in. Does anyone have any idea how to solve the problem? 

Thank you very much.

Related