Sending BLE multiple packages

Hello Group,

I'm trying to send I2C/twi data from nRF52832 using the Nordic development board with nRF Connect SDK 1.9.1.

Based on the sample project ble_app_uart, I was able to send one package of 240 bytes through the BLE mechanism in each connection interval of 40ms.

I want to send multiple packages (probably four) in each connection interval. I tried but got errors. (I searched questions and answers in the blog, but I couldn't find the solution)

Do you have any idea or example showing the setting for sending multiple packages?

Thanks a lot for your time,

Jack

// ===========

static void sensor_meas_timeout_handler(void* p_context)        
{
    if (IsSensorInitReady == false) { return; }
    if (IsUserRequestDataReady == false) { return; }

    // prepare data
    uint16_t length = PACKAGE_BLE_MAX_SIZE;
    ret_code_t      err_code;

    UNUSED_PARAMETER(p_context);
    kx132ReadFifo();

    err_code = ble_nus_data_send(&m_nus, BlePackageData, &length, m_conn_handle);
    if ((err_code != NRF_ERROR_INVALID_STATE) &&
        (err_code != NRF_ERROR_RESOURCES) &&
        (err_code != NRF_ERROR_NOT_FOUND))
    {
        APP_ERROR_CHECK(err_code);
    }

    // duplicate data testing sending multiple packages
    err_code = ble_nus_data_send(&m_nus, BlePackageData, &length, m_conn_handle);
    if ((err_code != NRF_ERROR_INVALID_STATE) &&
        (err_code != NRF_ERROR_RESOURCES) &&
        (err_code != NRF_ERROR_NOT_FOUND))
    {
        APP_ERROR_CHECK(err_code);
    }
    else
    {
        NRF_LOG_INFO("\n\r Error Multiple package ++++");
        NRF_LOG_FLUSH();
    }
}

Parents Reply Children
No Data
Related