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

sd_ble_evt_get questions

  1. I'm seeing the sd_ble_evt_get return NRF_ERROR_DATA_SIZE even though the supplied buffer and length param are larger than the event length. Is this a known benign issue?

If the following code

rc = sd_ble_evt_get(NULL, &evt_len); evt_buff_len = evt_len; // evt_buff_len = evt_len + 4; <-- in case evt_len is 0 rc = sd_ble_evt_get(myBuffer, &evt_buff_len);

if the evt_len returned is 0, rc is 12 or NRF_ERROR_DATA_SIZE Even if the evt_buff_len is set to 4, the rc is NRF_ERROR_DATA_SIZE

All other times, the rc is 0 (NRF_SUCCESS).

when there is no prior call the get the event length - following is executed in the same scenario as the above code rc = sd_ble_evt_get(NULL, &evt_len); evt_buff_len = 60; rc = sd_ble_evt_get(myBuffer, &evt_buff_len);

rc is NRF_ERROR_DATA_SIZE more often than when the size was originally obtained even when the evt_len is known to be smaller than the evt_buff_len.

  1. What is the max time that can elapse before I invoke sd_ble_evt_get to get an event from the BLE stack?

Thanks