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

Parents
  • Hi David,

    1. Is there a reason why you're not using the softdevice_handler library which is included in the SDK? This takes care of these things for you, as you may run into these issues if your buffer is not word-aligned in memory.

    2. This will depend on your link and your requirements. You can queue events, and just keep on pulling them until you get return code "NRF_ERROR_NOT_FOUND".

    Best regards Håkon

Reply
  • Hi David,

    1. Is there a reason why you're not using the softdevice_handler library which is included in the SDK? This takes care of these things for you, as you may run into these issues if your buffer is not word-aligned in memory.

    2. This will depend on your link and your requirements. You can queue events, and just keep on pulling them until you get return code "NRF_ERROR_NOT_FOUND".

    Best regards Håkon

Children
No Data
Related