Cannot enable BLE HCI survey

Dear Nordic support team,

I cannot enable the Nordic specific HCI command to enable the HCI survey, I always get the following error with NCS v2.6.1:

[    0.019409] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                        36 f0 e5 0e 87 68 48 fb  02 fd 9f 82 cc 32 e5 7b |6....hH. .....2.{
                                        91 b1 5c ed                                      |..\.             
[    0.022369] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[    0.022399] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[    0.022460] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 54.58864 Build 1214809870
[    0.023620] <inf> bt_hci_core: Identity: F3:05:51:37:EA:16 (random)
[    0.023651] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x118f, manufacturer 0x0059
[    0.023681] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x118f
[    0.025085] <wrn> bt_hci_core: opcode 0xfd0e status 0x01
[    0.025115] <err> BLE: Failed to enable HCI survey : -5

For information in the prj.conf file are enabled : 

CONFIG_BT_CTLR=y
CONFIG_BT_CTLR_CONN_RSSI=y
CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y
# Request a TX power in dBm. The power level set will be equal to or less than the one requested, based on the values supported by the hardware used.
# See https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/kconfig/index.html#CONFIG_BT_CTLR_TX_PWR_ANTENNA
CONFIG_BT_CTLR_TX_PWR_ANTENNA=18

CONFIG_BT_CTLR_SDC_QOS_CHANNEL_SURVEY=y

# Enable the Vendor Specific HCI event reporting to the user
# This is needed to know the BLE Quality of Service
CONFIG_BT_HCI_VS_EVT_USER=y
CONFIG_BT_HCI_VS_EVT=y

And the piece of code to enable the survey:

void BLE_QOS_enableChannelSurvey(BLE_CONNECT_QOS_CB cb) {
    struct net_buf *buf = NULL;

    int err = bt_hci_register_vnd_evt_cb(cb);

    if (err) {
        LOG_ERR("Failed to register HCI VS callback");
        return;
    }

    sdc_hci_cmd_vs_qos_channel_survey_enable_t *cmd_enable = NULL;

    buf = bt_hci_cmd_create(SDC_HCI_OPCODE_CMD_VS_QOS_CHANNEL_SURVEY_ENABLE,
                            sizeof(sdc_hci_cmd_vs_qos_channel_survey_enable_t));
    if (!buf) {
        LOG_ERR("Failed to create HCI survey registration");
        return;
    }

    cmd_enable = (sdc_hci_cmd_vs_qos_channel_survey_enable_t *)(net_buf_add(
        buf, sizeof(sdc_hci_cmd_vs_qos_channel_survey_enable_t)));
    cmd_enable->enable = 1;
    cmd_enable->interval_us = 3000000;

    err = bt_hci_cmd_send_sync(SDC_HCI_OPCODE_CMD_VS_QOS_CHANNEL_SURVEY_ENABLE, buf, NULL);
    if (err) {
        LOG_ERR("Failed to enable HCI survey : %d", err);
        return;
    }
}

called right after the BLE is enabled:

    int err = bt_enable(bt_ready);
    BLE_QOS_enableChannelSurvey(cb);

I don't understand why the HCI raises an error BT_HCI_ERR_UNKNOWN_CMD (0x01)  from hci_types.h since the survey is experimental but added in NCS v2.5.0 and I'm using NCS v2.6.1.

Could you tell me what's wrong in this simple piece of code ?

Thanks in advance !
Best regards,
Aurélien
  • Hi,

    In your setup your device act as a central or a peripheral  ? 
    If you take a look at \nrfxlib\softdevice_controller\readme.rst you will find this: 

    So if it's a peripheral it won't work. 
    I did a quick test with the central_uart and it seems to work (no error -5). I haven't started the survey through. Also I would suggest to wait until bluetooth stack is ready before you start. 


    1732.central_uart.zip

  • Hello M. Bui,

    Thank you for your support, my device is acting as "peripheral only" unfortunately... Do you know if this feature is planned soon for BLE peripherals ?

    Moreover, when should this feature be used ? When the central is connected to the peripheral ? I'm wondering what's the purpose of this survey.

    Thanks in advance,

    BRs
    Aurélien

  • Hi Aurélien,

    Please don't click Verified Answer if you still have question. 
    Channel survey can be used to detect which channels the BLE communication should use to avoid busy channel (when you have a lot of traffic on channel overlapping with Wifi  for example)

    Most often, it's the central that set the channel map table (from Bluetooth 5.3 peripheral can request as well). So that's why this channel survey feature is implemented on the Central and Multirole. 
    Another reason why it's not on the Peripheral as far as I know is to keep the size of the peripheral stack lower. 
    What you can try is to enable Central role and test again (even though you don't use Central role). The trade off is larger stack size.

Related