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
  • 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.

Children
  • 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

  • Thanks for the update. The sdk_config settings are actaully not applied unless they are referenced by your code. So it appears that 1600/800 is too long to reliably detect the coded PHY advertisments in your case.

Related