Identical code to Peripheral HR Coded sample not working in my own project

Hi,

I've tested the peripheral_hr_coded sample before; using the VSCode extension, I created a new project and selected "nrf/sampls/bluetooth/periphral_hr_coded" as the template, and the code ran as expected.

Now, I want to modify the peripheral_hr_coded sample and use it in my own project. Using SDK 2.4.0, in VSCode, I created a new project starting from the zephyr/hello_world sample. I then pasted in the exact code from the peripheral_hr_coded sample (both in main.c and proj.conf). The project builds successfully, but runs with this error:

W: opcode 0x2036 status 0x01
Failed to create advertiser set (err -5)
Advertising failed to create (err -5)

The error is caused by th function bt_le_ext_adv_create().

This behavior has happened on both nRF7002DKs I've tested on.

I suspect I need to do some other configuration of my project to get the code to run? What am I missing?

Thanks,

Michael

Parents
  • Hi Michael,

    "W: opcode 0x2036 status 0x01"

    This warning message means that support for the extended advertising feature has not been enabled in the Bluetooth controller running on the network core (hci_rpmsg). 

    Opcode 0x2036 corresponds to 'BT_HCI_OP_LE_SET_EXT_ADV_PARAM', and status 0x1 means the opcode was not recognized by the controller. Except from BT core spec., vol 1, part F:

    2.1 UNKNOWN HCI COMMAND (0x01)
    The Unknown HCI Command error code indicates that the Controller does not
    understand the HCI Command packet opcode that the Host sent. The opcode
    given might not correspond to any of the opcodes specified in this document,
    or any vendor-specific opcodes, or the command may have not been
    implemented.

    To fix this, copy the 'child_image' folder from the peripheral_hr_code sample to your project source directory and do a pristine build. The child image folder contains the hci_rpmsg.conf overlay which will be applied to your controller build and enable support for advertising extensions. 

    Best regards,

    Vidar

  • I see, thank you! Do you mind explaining the distinction/relationship between proj.conf in the root folder, the hci_rpmsg.conf in the child_image folder, and Kconfig?

Reply Children
  • Of course. When building BLE applications for the nRF5340, you are building separate FW images for the application core and network core as explained here link. This happens automatically and is made possible with the SDKs Multi-image builds feature. And since you are building multiple different FW images, there is also a need to be able to change override the default Kconfig symbols for each image individually. This is where the 'child_image' folder comes in. In this folder you can place overlays for your child images. Please refer to the Image-specific variables section for more details. 

    The Kconfig symbols in proj.conf file in the root folder will only be applied to the parent FW image (i.e. your application). 

Related