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

  •  I still find it a bit strange. Can you show me your complete advertising_init() function?

  • This is my function 

    /**@brief Function for initializing the Advertising functionality.
    */
    static void advertising_init(void)
    {
    ret_code_t err_code;
    ble_advertising_init_t init;
    ble_gap_adv_params_t m_adv_params;
    m_adv_params.channel_mask[4] =0x80;
    memset(&init, 0, sizeof(init));

    init.advdata.name_type = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance = true;
    init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.advdata.uuids_complete.p_uuids = m_adv_uuids;

    init.config.ble_adv_fast_enabled = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout = APP_ADV_DURATION;
    init.evt_handler = on_adv_evt;
    // m_adv_params.channel_mask[4] =0x80;

    err_code = ble_advertising_init(&m_advertising, &init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
    }

    nothing do additional . is it any wrong?

Related