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

S120 softdevice on nRF51822 : How to alternate between scanning and advertising

Hi,

On a nRF51822 (QFAAG0) with S120 softdevice (using the recent PCA 10001 v2.2.0 board), i'm trying to perform these operations successively:

  • a simple RSSI scan
  • stop scanning
  • start advertising

Refering to this topic : Can nRF51822 support both central and peripheral roles?, it's apparently not possible, but why offering peripheral functions on S120 then, like sd_ble_gap_adv_data_set(), instead of on S110 only?

Unsure of that, i gave it a try (a bit stubborn).

Scanning works well, but i can't manage to initialize advertising data properly using sd_ble_gap_adv_data_set() function, using ble_advdata_set() from ble_advdata.h library, based on the board/pca10001/s110/ble_app_proximity example

I get the following error: NRF_ERROR_NOT_SUPPORTED

Before going further, i'd like to know if it's potentially possible to alternate between these 2 operations on S120 ? If yes, is it possible to fill up the data field of the advertisement frame since it must contain the device name (referring to sd_ble_gap_adv_data_set notes) ?

Thanks in advance, Arnaud

  • As the question you linked to says, it is not possible to use the S120 as a Peripheral, i.e. to advertise. The functions are included in the header files, but will as you have found out return NRF_ERROR_NOT_SUPPORTED.

    Depending on your requirements, it could perhaps be an option to implement the scanner (or the advertiser, depending on which role you'll primarily use) in your application instead of using a softdevice. If you want to try this, you may have use in taking a look at this question.

    If you want information on future plans and developments, you should get in touch with our sales manager for your area. If you don't have his contact information, please send me a PM with your location.

  • Hi Ole

    Thanks a lot for your fast reply. I indeed missed out the possibility of implementing a scan without S120. It sounds like a pretty good option. I'm gonna give it a try.

  • Hi Arnaud,

    I just stumbled upon your question, as I am facing pretty much the same challenge. I need a device, which primarily is in the peripheral role. However, about every once a minute, the device should also do a scan (to detect the presence of a base station nearby). Therefore, I'd need a combination of (mainly) peripheral role and (sometimes) scanning role.

    Did you succeed yet in making a scan without S120? (do you have S110 then, or no SD at all?)

    Thanks, Mike

  • Hi, I am also in this situation where I need to primarly act as a peripheral, but on a regular basis scan for advertisements from another peripheral. I too was hoping the S120 would allow this operation but unfortunately it appears does not. I don't need all of the functionality of a central, just to be able to scan for advertisements (I am planning on having my information broadcast in the advertisement on the other sensor). Vaio, Arnaud, any guidance on your success would be appreciated. Thanks, Scott

  • Hi Ole, I have also to alternate between scanning and advertising but I am still waiting for the boards so I couldn't try anything yet :) I was reading the documentation for the SD S120 v2.1 and it says that the stack is initializable at runtime as either Central or Peripheral therefore I was wondering if it is possible to use the S120 to alternate between scanning and advertising and if there is any drawback in doing that. My idea is to initialize the stack as peripheral, advertise for a certain period, close the stack, initialize it as central, scan for a certain period and then repeat. Is this approach feasible? Thanks!

Related