Selecting advertisement channel in BLE_ADV_MODE_IDLE

Hi everyone,

In a project, i am trying to use only channel 38 for extended long range advertising.

Is it possible select only one advertising channel using channel masks in BLE_ADV_MODE_IDLE mode in SDK17.02 and S140?

Regards,

  • Hello,

    In Bluetooth Low Energy (BLE) advertising, the channel selection is typically controlled by the BLE stack or the firmware running on the BLE device. The channel selection is not directly controlled through the advertising mode itself.

    In the nRF SDK17.02 and S140 SoftDevice, the advertising channels are typically selected automatically by the stack based on the advertising settings. The channel masks, on the other hand, are used to enable or disable specific channels for advertising.

    If you want to advertise only on a specific channel, such as channel 38, you can achieve this by modifying the channel mask settings in your firmware. You would need to disable all channels except for channel 38 in the channel mask configuration.

    Here's an example of how you can configure the channel mask in the SoftDevice:

    ble_gap_adv_params_t adv_params;
    adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
    adv_params.primary_phy = BLE_GAP_PHY_CODED;
    adv_params.secondary_phy = BLE_GAP_PHY_CODED;
    adv_params.duration = BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED;
    adv_params.p_peer_addr = NULL;
    adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
    adv_params.channel_mask[0] = 0x00000000; // Disable channels 0-31
    adv_params.channel_mask[1] = 0x00000000; // Disable channels 32-63
    adv_params.channel_mask[2] = 0x00000004; // Enable only channel 38
    
    err_code = sd_ble_gap_adv_set_configure(&adv_handle, &adv_data, &adv_params);

    In the above example, channel_mask[2] is set to 0x00000004, enabling only channel 38 for advertising. You can adjust the channel mask according to your requirements.

Related