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

Large data transfer [nRF5 SDK v. 11, nRF52-DK, BLE]

Dear Forum Users,

I am trying to send the data in a burst. Thanks to this post I have managed to achieve ~2,5 kB/s. However this lasts only for few seconds. Then the stream is 4 packets long after which occurs a short break. This happens cyclically from then on and results in transfer drop to 80-160 B/s.

Could this be caused by the fact of using different SDK? Why is it so and how can it be improved?

The sending function heart_rate_meas_timeout_handler in nRF5 DK is a timer handler, so I stop the timer using app_timer_stop(). I have noticed that stopping battery_level_meas also causes the system working slowly.

Thank you for your help!

static void heart_rate_meas_timeout_handler(void )
{
    static uint32_t cnt = 0;
    uint32_t        err_code;
    uint16_t        heart_rate;

    err_code = app_timer_stop(m_heart_rate_timer_id);
    APP_ERROR_CHECK(err_code);

    heart_rate = (uint16_t)sensorsim_measure(&m_heart_rate_sim_state, &m_heart_rate_sim_cfg);

while(true)
{
    if (cnt < 300)
    {

    err_code = ble_hrs_heart_rate_measurement_send(&m_hrs, cnt);
    if (err_code == BLE_ERROR_NO_TX_PACKETS ||
        err_code == NRF_ERROR_INVALID_STATE ||
        err_code == BLE_ERROR_GATTS_SYS_ATTR_MISSING)
    {
        break;
    }
    else if (err_code != NRF_SUCCESS)
    {
        APP_ERROR_HANDLER(err_code);
    }

    cnt++;
}

in on_ble_evt():

 case BLE_EVT_TX_COMPLETE:
      heart_rate_meas_timeout_handler();
      break;
Parents
  • Central device is other nRF52 DK. I am stopping the timer as I use heart_rate_meas_timeout only to initiate the data burst. Then, as in aforementioned example, I send the data in while loop to achieve the fastest transfer. Thus yes, the timers make the device send notifications in the original example, but this one is changed according to needs (I am editing the original post to attach the code).

Reply
  • Central device is other nRF52 DK. I am stopping the timer as I use heart_rate_meas_timeout only to initiate the data burst. Then, as in aforementioned example, I send the data in while loop to achieve the fastest transfer. Thus yes, the timers make the device send notifications in the original example, but this one is changed according to needs (I am editing the original post to attach the code).

Children
No Data
Related