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

scanning and connection establishment parameters

Hi,

I have a question about scan window and interval [I'm using nrf51822aa with s130 2.0.1... I performing some tests and I find a use case: If I set both of them (scan interval and window) to 0x140 - 200ms then radio scans all the time, after that I stop the scanning and create connection...

Once I get event that connection is established (with connection interval 20ms) I would like to start scanning once again - with same scanning params (interval 200ms and window 200ms) - What is from my perspective not possible because scanning procedure could not use radio for 100% if connection is established... but softdevice allows me to use such params (I get NRF_SUCCESS) - even it's not possible to work with such params or am I wrong? Of course none of device is found - once I use a bit more reasonable params (interval 200ms, window 50ms) everything works just fine

Now I am wondering how is this solved/protected in softdevice that user can set such things for scanning or creating connection params?

I expose softdevice functions to end user via API with all supported params, but I see that user could also enter/trigger some strange behaviour... Should I limited user at entering params considering on number of established connections?

Thank you for info.

Best regards, Matej

Parents Reply Children
  • Thank you for info Petter! So I also should take in account number of established connections and all of connection intervals - which also should use multiple to avoid some possible schedule collisions? In case that some of device would like to update/change connection interval – is it on my side that I check if this proposed connection interval is acceptable according to already connected devices and intervals that are already used?

    Thank you.

    BR, Matej

  • I guess you should, but it is up to you :) The central device dictates the connection interval, the peripheral can only request a connection parameter update, the central decides if it wants to accept or reject. See this MSC.

  • Hi, it's been a while since this topic... So I'm wondering if there are some news about that.

    I have established peripheral link and after that user start scanning (sd_ble_gap_scan_start) with interval 200ms and also window 200ms. Of course such parameters are not possible, because part of timeslot is already used for peripheral connection – so scanning with such configuration is not possible.

    Regarding to this chapter somehow I expect to get NRF_ERROR_RESOURCES error. But actually peripheral connection is terminated and scanning is started. What do you suggest? Except limiting user to enter such parameters.

    Thank you for update ;)

    BR, Matej

  • News about what? :)

    It is possible to tell the SoftDevice to use those parameters, but it will of course not be able to scan 100% of the time and maintain a connection, the scanning and connection events will be scheduled according to the chapter you linked to. I don't see how you end up with expecting NRF_ERROR_RESOURCES by reading that chapter, could you explain a bit more?

    The peripheral connection isn't necessarily terminated, but it depends a bit on the connection parameters. It can hit the supervision timeout and get linkloss. I don't have any other suggestions than limiting the user to enter such parameters.

  • I came up to such conclusion with reading doxygen comment sd_ble_gap_scan_start of function... where is written: "Not enough BLE role slots available. Stop one or more currently active roles (Central, Peripheral or Broadcaster) and try again"

    Considering priorities... then peripheral link should not starve, because of such scanning parameters. Peripheral link have the highest priority while observer/broadcaster is on the 3rd place.

    After all, I assume that in case if I already have established connection peripheral or central and then I call function to scan with 100% of time. I should get error NRF_ERROR_RESOURCES - considering to description.

    Or when it is possible to trigger that error?

    Thank you for additional info Petter.

    BR, Matej

Related