Bluetooth LE Fundamentals Lesson 2 Exercise 3 bt_enable(NULL) failing on nrf5340dk, code -22

Problem with exercise code in a developer academy fundamentals course.

Exercise:

  • Bluetooth LE Fundamentals Lesson 2 Exercise 3

SDK:

  • v2.9.1

Board Target:

  • nrf5340dk/nrf5340/cpuapp/ns

Using the example solution files for main.c and prj.conf from the v2.9.0-v2.7.0 branch of the bt_fund repo (GitHub), I get the following warning and error.

[00:00:00.315,887] <wrn> bt_hci_core: opcode 0x0c33 status 0x12
[00:00:00.315,917] <err> Lesson2_Exercise3: Bluetooth init failed (err -22)

I understand there are some special cases for developing on the nrf5340 to account for the dual-core architecture.
Specifically that operation of the Bluetooth LE radio is offloaded to the networking core.

As such I have tried changing the build target to nrf5340dk/nrf5340/cpunet as a test, but got more errors and different error codes.

[00:00:01.253,875] <err> bt_hci_driver: Endpoint binding failed with -11
[00:00:01.253,906] <err> bt_hci_core: HCI driver open failed (-11)
[00:00:01.253,906] <err> Lesson2_Exercise3: Bluetooth init failed (err -11)

I also have an nrf52840dk, and was able to build and flash the same code onto it with no issues, so the issue seems localised to the 5340.

  • Upon further inspection this seems to be resolved by setting the build configuration to not use sysbuild.

    Doing so will generate and build a parent-child image with separate application and network images, which runs correctly when flashed to the nrf5340dk.

    I suppose now I just need to know if sysbuild is actually meant to work, or if I should switch to not using sysbuild for all future development on the 5340.

Related