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

How to resolve packet drops during large data transfer?

Hi there,

I need to transmit 33995520 bytes from nrf52 peripheral device to a Windows/Android device. Currently it takes about 13 to 14 minutes to complete the data transfer with some packet drops. My connection parameters are as follows-

#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(7.5, UNIT_1_25_MS)	/**< Minimum acceptable connection interval (0.1 seconds). */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(15, UNIT_1_25_MS)     /**< Maximum acceptable connection interval (0.2 second). */
#define SLAVE_LATENCY                   0                                           /**< Slave latency. */
#define CONN_SUP_TIMEOUT                MSEC_TO_UNITS(10000, UNIT_10_MS)    /**< Connection supervisory timeout (4 seconds). */

#ifndef NRF_SDH_BLE_GAP_EVENT_LENGTH
#define NRF_SDH_BLE_GAP_EVENT_LENGTH 400//6	
#endif

#ifndef NRF_SDH_BLE_GATT_MAX_MTU_SIZE
#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 230//247//35//23
#endif

#ifndef NRF_SDH_BLE_GAP_DATA_LENGTH
#define NRF_SDH_BLE_GAP_DATA_LENGTH 234//233//27
#endif

case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
        {
            NRF_LOG_DEBUG("PHY update request.");
            ble_gap_phys_t const phys =
            {
                .rx_phys = BLE_GAP_PHY_2MBPS,
                .tx_phys = BLE_GAP_PHY_2MBPS,
            };
            err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
            APP_ERROR_CHECK(err_code);
        }break;

Overall, I see ~6 packets getting dropped. 

I tried to add more checks like tracking BLE_GATTS_EVT_HVN_TX_COMPLETE or looking out for NRF_SUCCESS but then I lose more data. I also tried to increase the connection interval to 50 to 100 ms, still the same result. Do you have any suggestions?

Parents Reply
  • The OTS example is located in <SDK_FOLDER>\examples\ble_peripheral\experimental\ble_app_ots

    I'm afraid nothing else comes to mind. Making sure the TX_COMPLETE events should be eliminate the lost packets as far as I know. You can try to sniff the connection with I.E. the nRF Sniffer so we can see what's going on over the air. That way we can see if they're lost at the receiving end or if they're not sent at all.

    Best regards,

    Simon

Children
Related