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

Parents
  • 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, 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!

Reply
  • 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!

Children
No Data
Related