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

Is it possible to BLE scanning in one channel instead of 3 channel?

Dear nordic,

BLE advertising happens in 3 channel(37,38,39) and scanner scans these channel based on scan interval consecutively

I want to scan single channel instead of scanning 3 channels consecutively . Is it possible to scan one channel?

can you help me to solve this?

Parents Reply Children
  • Thanks i see channel mask in SDK 15.0.0 . 

    channel mask has 40 bits that is 5 byte LSB for channel index 0 and MSB for channel index 39 if i set channel mask MSB to 0 and next 2 bits set to 1 scanning happens in channel 39 only is it right procedure for scanning one channel?

  • You can do like this (modified from this post):

    /** @brief Parameters used when scanning. */
    static ble_gap_scan_params_t const m_scan_params =
    {
        .active             = 1,
        .interval           = SCAN_INTERVAL,
        .window             = SCAN_WINDOW,
        .timeout            = SCAN_DURATION,
        .scan_phys          = BLE_GAP_PHY_1MBPS,
        .filter_policy      = BLE_GAP_SCAN_FP_ACCEPT_ALL,
        .channel_mask[4]    = 0x60, // <- DON'T SCAN ON CHANNEL 37 or 38
    };

  • Sorry for late reply

    I tested as per above modification 

    For testing i use two nrf device one as Scanner and other as Advertiser

    Scanner:-

    static ble_gap_scan_params_t const m_scan_params =
    {
    .active = 1,
    .interval = SCAN_INTERVAL,
    .window = SCAN_WINDOW,
    .timeout = SCAN_DURATION,
    .scan_phys = BLE_GAP_PHY_1MBPS,
    .filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL,
    .channel_mask[4] = 0x60, // <- DON'T SCAN ON CHANNEL 37 or 38
    };

    Advertiser:- modified in advertising_init(void)

    ble_gap_adv_params_t m_adv_params;

    m_adv_params.channel_mask[4] =0x80;

    modified for Advertising in Channel's 37 and 38 advertising

    But i get Advertising in Scanner(scanning only in 39 channel) how its possible?

    Is it any mistake in my procedure?

  • That's odd. What do you do with m_scan_params m_adv_params after setting the channel mask_field? Can you upload the full source code for the advertise and scanner?

  • I tested Central peripheral example in SDk 15 

    I am just modified  in scanner side

    static ble_gap_scan_params_t const m_scan_params =
    {
    .active = 1,
    .interval = SCAN_INTERVAL,
    .window = SCAN_WINDOW,
    .timeout = SCAN_DURATION,
    .scan_phys = BLE_GAP_PHY_1MBPS,
    .filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL,
    .channel_mask[4] = 0x60, // <- DON'T SCAN ON CHANNEL 37 or 38
    };

    and modified in advertiser side in advertising_init(void)

    ble_gap_adv_params_t m_adv_params;

    m_adv_params.channel_mask[4] =0x80;

    just two things modified nothing more

Related