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

nRF Beacon with Scanning Feature

Hi,

I have a couple of nRF Beacons and want to change the program so that it scans for iBeacon packets before starting to advertise.

The flashed program is just advertising and I think uses S110 soft device. Correct me if I'm wrong:

  • For adding the scan feature I have to program S130, and I expect that the same program (advertising) should work without any change, but it will just give me the feature of scanning too.

  • I need a simple example for "scanning". I think the "Sniffer" program does that on the nRF DKs but that one is in HEX only.

  • I found this topics: devzone.nordicsemi.com/.../

I think I should be able to use the scanning features from that program, but as the program was with S130 0.9.0-1 and PCA10001, would it cause a problem? I'm still a beginner about nRF MCU registers and board specific pins, but I think one of the tutorials was saying that you can change the target board in Keil and the required header files will be added, so that the program should run on a different board (here PCA20006).

Thanks, FA main_woPointer.c main_wPointer.c

Parents
  • SoftDevice S120 can be a periheral or a central, while S130 can be a peripheral and a central.

    You advertising program should work.

    The sniffer is something else. You should look at the examples in ble_central or ble_central_and_peripheral.

    I ported the example in the linked question to SDK 9.0.0 and S130 1.0.0. Download here. Used ble_app_hrs_rscs_relay as a base, I didn't clean the project, but main.c is clean.

    Unzip it into \examples\ble_central_and_peripheral\experimental\

    You need to put the address of the device you are scanning for into search[].

    LED1 will toggle every time you recieve an advertising packet from the other device.

Reply
  • SoftDevice S120 can be a periheral or a central, while S130 can be a peripheral and a central.

    You advertising program should work.

    The sniffer is something else. You should look at the examples in ble_central or ble_central_and_peripheral.

    I ported the example in the linked question to SDK 9.0.0 and S130 1.0.0. Download here. Used ble_app_hrs_rscs_relay as a base, I didn't clean the project, but main.c is clean.

    Unzip it into \examples\ble_central_and_peripheral\experimental\

    You need to put the address of the device you are scanning for into search[].

    LED1 will toggle every time you recieve an advertising packet from the other device.

Children
  • Ok, I used the short program you prepared as follows: I wanted to scan first and after receiving a packet from a specific address, start advertising. So, I used SCAN_START() and after that put an empty WHILE loop like "WHILE (!start) {}, with START initialized to zero and trying to change it when an address match is detected in SWITCH-CASE of ON_BLE_EVT function. Here is what happened: The program can detect the correct address, but it seems it can not change the value of START and as a result it won't come out of the empty while loop! I think this should be a problem of declaration of START and if the "STATIC void ON_BLE_EVT" function is able to change that. Any help in this method or any other suggestions is welcomed! So, problem is: we have a global variable set to 0 and used as WHILE condition. We want it to be changed when the BLE EVENT is detected and the address is matched

Related