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

What is the right way to deal with NRF_ERROR_BUSY in a complex multirole application under FreeRTOS?

I'm developing a central that may have to service more than one peripheral concurrently while (occasionally) advertising its own peripheral service. Things seem to work OK under FreeRTOS, but on occasion I still run into the dreaded NRF_ERROR_BUSY when I try to initiate certain actions in response to events.

What is the preferred architecture to deal with this? Is there some kind of built-in asynchronous "queue with retry"? Or do I have to roll my own?

Parents Reply
  • Yes. If you look at the API documentation for sd_ble_gattc_primary_services_discover() it states that NRF_ERROR_BUSY is returned when a "Client procedure already in progress."

    Please note that there is no generic way to handle this or most other return values other than RNF_SUCCESS. You need to understand the API of the functions you call and handle the possible return values. Any unhandled values will typically be caught by an APP_ERROR_CHECK and lead to a reset, as a last resort way of recovering from unhandled errors.

Children
Related