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

Problem with scanning 1Mbps and Coded Phy at the same time

Hello,

we want to support scan for both 1Mbps and Long Range beacons and we are using the S140 6.1.0.

This is the configuration for the scan parameters:

#define SCAN_INTERVAL 0x0640
#define SCAN_WINDOW 0x0320
#define SCAN_DURATION 0

static ble_gap_scan_params_t m_scan_param =                 /**< Scan parameters requested for scanning and connection. */
{
    .active        = 0x00,
    .interval      = SCAN_INTERVAL,
    .window        = SCAN_WINDOW,
    .filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL,
    .timeout       = SCAN_DURATION,
    .scan_phys     =  BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_CODED,
    .extended      = 1,
};

When this is the case, I only see beacons that are advertising on 1MBPS and I cannot see the beacons that are advertising on CODED PHY.

When I set the scan_phys to BLE_GAP_PHY_CODED only or BLE_GAP_PHY_1MBPS only, I am able to see the beacons that are advertising on CODED PHY and 1MBPS, respectively.

What can be the problem? How can I scan for both CODED_PHY and 1MBPS?

I saw this post and thought it would work for me as well. Do I need to change some other configuration too?

Thanks.

Parents Reply Children
  • Hello Vidar,
    the 1M advertising interval is 300ms and I have 9 beacons in range, and for the CODED advertisement I am using Nordic_Blinky example and it is advertising on 40 ms. Could the advertising interval be a problem?

    Thanks

  • Hello,

    Thanks for confirming, the advertising interval should be ok, espesially as you have several beacons in range. The reason I asked was that I was wondering if there was a chance for the scan window to never overlap with the advertisment event.

    Attached below is the projects I made to test this. Could you go over those and possibly try them to see if it works on your side as well?

    Test projects based on nRF5 SDK 15.2.0/s140 v6.1.0

    ble_app_beacon_adv_ext.zip

    ble_app_beacon_scanner.zip

    Excepted log output from the scanner and beacon in SES

  • Hello Vidar,

    Thanks for uploading your projects. I went through the main.c for the scanner and I could not find anything different from my code.

    I checked the sdk_config.h file as well, and there I saw this:

    NRF_BLE_SCAN_SCAN_WINDOW 800

    NRF_BLE_SCAN_SCAN_INTERVAL 1600

    In my sdk_config.h file these were 80 and 160, respectively. I changed them to 800 and 1600 and now I can see both 1MBPS and CODED beacons.

    I define these intervals in the main.c as 80 and 160. Why are these in the sdk_config.h 10 times larger?

    Thanks

  • Hello,

    I chose this interval and window size because I thought it was the same as you were using.  The code snippet you posted shows that the interval is set to 0x0640, which should be the same as 1600, unless I'm missing something.

    In any case, it still works for me after I repeated the test with the interval and scan window set to 160/80, so I'm a bit suprised it doesn't work for you. I would have expected the opposite result if anything as a shorter interval will make the Softdevice switch PHYs more frequently.

  • Hello,

    I did some testing now and here are the results:
    SCAN_INTERVAL 1600
    SCAN_WINDOW 800 in main.c  and 

    NRF_BLE_SCAN_SCAN_INTERVAL 1600
    NRF_BLE_SCAN_SCAN_WINDOW 800 in sdk_config.h  ---> I cannot see CODED PHY beacons.

    SCAN_INTERVAL 1600
    SCAN_WINDOW 800 in main.c  and 

    NRF_BLE_SCAN_SCAN_INTERVAL 160
    NRF_BLE_SCAN_SCAN_WINDOW 80    in sdk_config.h  ---> I cannot see CODED PHY beacons.

    SCAN_INTERVAL 160
    SCAN_WINDOW 80 in main.c  and 
    NRF_BLE_SCAN_SCAN_INTERVAL 1600
    NRF_BLE_SCAN_SCAN_WINDOW 800  in sdk_config.h  ---> I can see CODED PHY beacons.

    SCAN_INTERVAL 160
    SCAN_WINDOW 80 in main.c  and 
    NRF_BLE_SCAN_SCAN_INTERVAL 160
    NRF_BLE_SCAN_SCAN_WINDOW 80  in sdk_config.h  ---> I can see CODED PHY beacons.

    I assume that the sdk_config.h configuration takes place if the parameters are omitted in main.c file, right?

    And regarding the results, I can conclude that when SD is switching PHY more frequently, I can see the CODED PHY beacons. (The advertising interval for CODED PHY is 40ms as stated above).

    Are the results okay?

    Thanks

Related