lookup meaning of bt_hci_core: opcode 0x2036 status 0x07

I have a project that I'm pulling in code from multiple_adv_sets using v2.7.0 and sysbuild.


Where can I find definition of bt_hci_core: opcode 0x200a status 0x09??? 

talks about the opcodes and status being in the spec?
https://www.bluetooth.com/specifications/specs/core-specification-5-3/

That spec is pretty large, it isn't clear to me where these are specified.  I did search for 2036.

Created adv: 0x200037d0
[00:00:00.084,136] <wrn> bt_hci_core: opcode 0x2036 status 0x07
Failed to create a connectable advertising set (err -5)

For additional background,
On startup from power off, the bt_hci_core output doesn't get all the way through, it is not always terminated at the same place.

[00:00:00.050,964] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.051,849] <inf> bt_hci_core: HW Variant: nRF53x (0x0003)
[00:00:00.052,734] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
[00:00:00.054,779] <inf> b[00:00:08.118,682]

it then continues to run but its not clear from output what was and wasn't run after the bt_hci_core fails to initialize.

----

[00:00:00.055,908] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.056,793] <inf> bt_hci_core: HW Variant: nRF53x (0x0003)
[00:00:00.057,678] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
[00:00:00.059,661] <inf> bt_hci_core: No ID address. App must call settings_load()
[00:00:00.062,835] <inf> bt_hci_core: Identity: X:X:X:X:X:X (random)
[00:00:00.063,720] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x21fb, manufacturer 0x0059
[00:00:00.064,849] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x21fb

If I wake sense after the initial power on, all the normal bt_hci_core output lines show with the -5 return code and the opcode and status code.

The code that is returning the -5 is:

err = advertising_set_create(&ext_adv[CONNECTABLE_ADV_IDX], connectable_adv_param,
                     connectable_data, ARRAY_SIZE(connectable_data));
    if (err) {
        printk("Failed to create a connectable advertising set (err %d)\n", err);
    }

I have defined to support existing code.

CONFIG_BT_BROADCASTER=y
CONFIG_BT_OBSERVER=y

and I'm now trying to use multiple_adv_sets to provide the beacon and connectable service.
I've pulled all the settings from the prj.conf in multiple_adv_sets.  I'm using sysbuild and I have the ipc_radio prj.conf defined.
The original existing broadcast/observer code is working even though this bt_hci_core has crashed/failed to initialize.

CONFIG_BT_PERIPHERAL was assigned the value y, but got the value n. Missing dependencies:
BT_RPC_STACK || (BT_HCI && BT)


I've tried adding BT_RPC_STACK and defining BT_HCI

CONFIG_BT_HCI was assigned the value y, but got the value n. Missing dependencies:
<choice BT_STACK_SELECTION>

I've got more notes; I've spent some time on this.  Any help is greatly appreciated.
Parents
  • Hello,

    The Bluetooth specification does specify the opcodes for all HCI commands (except vendor specific ones), the problem is that the value is split into fields named OCF and OGF, so the opcode value from the error log is not directly searchable. 

    I use to search for the opcode in the SDK tree instead:

    The status code can be found in the specification. See Vol. 1, Part F, Chapter 2.

    This error may, for instance, be raised if you try to add more advertisement sets than what has been allocated by the CONFIG_BT_CTLR_ADV_SET symbol in the 'ipc_radio' build. You can confirm the configurations set for the ipc_radio build by checking the generated .config file in build/ipc_radio/zephyr.

    and I'm now trying to use multiple_adv_sets to provide the beacon and connectable service.
    I've pulled all the settings from the prj.conf in multiple_adv_sets.  I'm using sysbuild and I have the ipc_radio prj.conf defined.
    The original existing broadcast/observer code is working even though this bt_hci_core has crashed/failed to initialize.

    CONFIG_BT_PERIPHERAL was assigned the value y, but got the value n. Missing dependencies:
    BT_RPC_STACK || (BT_HCI && BT)

    Did you also include the Kconfig.sysbuild file which enables the NRF_DEFAULT_IPC_RADIO symbol? And did you see the Kconfig warning while building the ipc_radio or the main application?

    Best regards,

    Vidar

  • Thank you for teaching me how to fish and making me a meal.

    I was able to get the the additional beacon and connectable service working by setting:

    CONFIG_BT_CTLR_ADV_SET=3 in prj.conf in sysbuild/ipc_radio

    .
    The first time the device turns on the output still terminates; wake sensing the device works as expected.
    Any ideas on how to go about debugging that?  I need to do some more testing...I keep seeing connected and disconnected events with (reason 19) happening; more to look into another fishing expedition for a code but I'm happy to see the services.  lmk if you've seen this before.

    >Did you also include the Kconfig.sysbuild file which enables the NRF_DEFAULT_IPC_RADIO symbol? And did you see the Kconfig warning while building the ipc_radio or the main application?

    Yes, I included the Kconfig.sysbuild and the symbol is enabled.  I did not see a warning and I don't see one in your screenshot.

  • tldr said:
    The first time the device turns on the output still terminates; wake sensing the device works as expected.
    Any ideas on how to go about debugging that?  I need to do some more testing...I keep seeing connected and disconnected events with (reason 19) happening; more to look into but I'm happy to see the services.  lmk if you've seen this before.

    Disconnect reason 19 corresponds to BT_HCI_ERR_REMOTE_USER_TERM_CONN and indicates that the connection was terminated by the peer device. Do you have any BLE security enabled in your application? Reason for asking is that the peer device may in some cases terminate the connection if it fails to secure the connection.

    Regarding the missing log messages, are you printing logs over RTT or UART. If using RTT, it may help to increase the 'CONFIG_SEGGER_RTT_BUFFER_SIZE_UP' size. The main() thread does not yield to the log processing thread during initilization which may cause the log buffer to become full. 

    CONFIG_BT_PERIPHERAL was assigned the value y, but got the value n. Missing dependencies:
    BT_RPC_STACK || (BT_HCI && BT)

    I was wondering where and when you saw the Kconfig warning above. I was not sure what could have caused this as both BT_HCI and BT should be enabled in the application.

    CONFIG_BT_RPC_STACK should only be enabled if you want to run the whole BT stack on the netcore: https://docs.nordicsemi.com/bundle/ncs-2.7.0/page/nrf/device_guides/nrf53/features_nrf53.html 

  • Spot on Vidar.

    CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=4096

    Gives me the whole output!  That's a huge problem solved for me.  Why the difference in behavior from cold start and wake sense?  The 1024 default might be changed if normal output causes RTT users to get cut off.

    >Do you have any BLE security enabled in your application?

    I have exactly what is coming from multiple_adv_sets, which I believe does nothing with security.  I was wondering if its from nrf connect or some other device I have.  There is no other peer;  no other device is scanning and I'm not using nrfconnect when the connections and disconnections occur.

    > I was wondering where and when you saw the Kconfig warning above.
    The warning came from the tooltip hover provided in vscode that shows you the criteria for the flag.  I was reaching...

  • Disconnected: A4:F9:33:82:A2:FC (public) (reason 19)
    Connected A4:F9:33:82:A2:FC (public)
    Advertiser[2] 0x20001278 connected conn 0x20001408
    Disconnected: A4:F9:33:82:A2:FC (public) (reason 19)

    That mac address does not show in the nrf scanner; not sure what else to try.

  • The connect/disconnect is not happening on the thingy53.  It only happens on the nrf5340DK.
    I do not have special conf or overlay files for the dk. If the code helps, send me an email from my profile address and I will provide.

Reply Children
  • It seems like you have a central device within BLE range that keeps connecting and disconnecting with your nRF5340 DK, and it's probably filtering on the BLE address since you are not seeing these connection attempts being made when using the Thingy.

    The OUI in the public address of the Bluetooth central is registered to Intel, so I guess the connections are made from a nearby PC with an Intel BT/Wifi chipset. 

  • Impressed you were able to discern that from the information given.  The machine I am using has an intel bt chipset and this DK I have had paired as a mouse using peripheral_hids_mouse.  I tried the other DK board I have and it didn't exhibit the behavior either so that makes sense.

    The hids mouse does not exist in this project yet, I will be attempting to do that.  I'm surprised by the way in which it beats up the connection; if the service doesn't exist, you'd think it would back off at some point.  It looks like a denial of service it connects so many times. 

  • Trying to advertise the peripheral_hids_mouse via advertising_set_create


    [00:00:41.568,359] <wrn> bt_hci_core: opcode 0x2039 status 0x0d
    00> [00:00:41.575,408] <err> bt_adv: Failed to start advertiser
    00> Failed to create a connectable advertising set (err -12)

    devzone.nordicsemi.com/.../insufficient-resources-warning-when-connecting
    > The status states BT_HCI_ERR_INSUFFICIENT_RESOURCES, and from what I've found, the opcode 0x2039 stands for BT_HCI_OP_LE_SET_EXT_ADV_ENABLE

    I've up'd the CONFIG_BT_CTLR_ADV_SET and I think that is correct, any suggestions appreciated.

  • Thank you. 

    tldr said:
    The hids mouse does not exist in this project yet, I will be attempting to do that.  I'm surprised by the way in which it beats up the connection; if the service doesn't exist, you'd think it would back off at some point.  It looks like a denial of service it connects so many times. 

    I agree, it seems like it would make sense for the PC to back off after a few attempts. The link is probably terminated by the PC when the peripheral reports "pin or key missing" in response to the encryption request. Since it is HID over GATT, which is natively supported by most operating systems, the re-connections in the background will be handled by the OS and not through an app/program. However, it is possible to make the peripheral ignore connection requests from "unknown" devices by using the Bluetooth Filter Accept List feature

    tldr said:
    [00:00:41.568,359] <wrn> bt_hci_core: opcode 0x2039 status 0x0d
    00> [00:00:41.575,408] <err> bt_adv: Failed to start advertiser
    00> Failed to create a connectable advertising set (err -12)

    It may be that the controller does not have the resources to start advertiser at the time of the request. I'm not sure where in your code you are starting the advertiser here, but please try to offload this task to the system workqueue to see if that fixes the problem. 

    Here's an example where advertisment start task is offloaded to the workqueue: https://github.com/nrfconnect/sdk-nrf/blob/b3293095a1374d9fa4a7480fb5d145760155596e/samples/bluetooth/peripheral_hr_coded/src/main.c#L82 

  • The hids_mouse also does the workqueue to decouple the advertising and I pulled that in.  I also attempted to wrap my other calls that were from adv_multi sample in a workqueue and did not see a difference.

    Let me know if you have any other ideas.  I will keep shuffling code...
    -----
    Everything looks to be working now from nrf connect.  Any ideas on why I would not be seeing the device on my windows PC since changing it to bt_le_ext_adv_start?
    ----
    Nordic_HIDS_mouse shows up and it connects and shortly after it tells me driver error.  I will keep trying...if you know of a way to debug the interaction between the mouse and the windows pc. lmk
    ---
    Working!  Had to get the Kconfig correct; you can't do windows mouse without 
    BT_HIDS_SECURITY_ENABLED

    I had troubles with 
    BT_DIRECTED_ADVERTISING

    I disabled that; with it I could not see the device.  Regardless, thank you for your help Vidar.


Related