NRF5340-DK BLE examples fail to initialize

I am trying to use a 5340 BLE example project in VSC as a starting point.  I have two NRF5340-DK boards, both 2.0.0.  Whatever example I try, bt_enable always fails.  For example, the peripheral_uart example fails with HCI driver open failed.  I've tried the LBS and coded-hr examples as well.

I have captured a video of the process here:

https://youtu.be/XV-GMkifqJU

It's been a couple days, but I think the first time I tried the UART example it actually worked.  This was on a DK board that already had a programmed NETCPU with the RPC code.  But after doing a board erase, I could never get any of the BLE examples working again, so it almost looks like the NETCPU isn't getting loaded.

Parents
  • I have traced the error to a memory allocation in virtqueue.h:

    static inline struct virtqueue *virtqueue_allocate(unsigned int num_desc_extra)
    {
    	struct virtqueue *vqs;
    	uint32_t vq_size = sizeof(struct virtqueue) +
    		 num_desc_extra * sizeof(struct vq_desc_extra);
    
    	vqs = (struct virtqueue *)metal_allocate_memory(vq_size);
    	if (vqs) {
    		memset(vqs, 0x00, vq_size);
    	}
    
    	return vqs;
    }
    

    It is attemping to k_malloc a size of 2100 bytes.  The heap size has been set in prj.conf as 2048 bytes by default.

    Unfortunately, increasing the heap size to 4096 doesn't work, because there are two allocations of 2100 bytes.

    Increasing the heap further to 8000 causes the system to crash to disassembly sometime after.

    This now looks like some sort of configuration error.

  • Deleting the ncs folder and reinstalling solved this issue.

  • Hi Nick

    Thanks, I haven't seen reports of this issue before. If it happens again please let us know ;)

    Best regards
    Torbjørn

  • Hi Torbjørn,

    I have the same issue !

    I've just reinstall the latest nRF Connect SDK (v2.3.0) and still have the issue. I've set the HEAP, WORKQUEUE_STACK and RPC_THREAD_STACK sizes to 8192. The project builds successfully, but still the same error at runtime : 

    [00:00:01.457,550] <err> bt_hci_driver: Endpoint binding failed with -11
    [00:00:01.457,580] <err> bt_hci_core: HCI driver open failed (-11)

    So for me the trick of deleting the ncs folder does not work...

    I've tried to track the issue and the error appears at line 3731 of hci_core.c:

    err = bt_dev.drv->open();
    where the open() method returns the value -11 (No more contexts ?)

    I also have checked that both core are flashed using nRF Connect Desktop. It seems to be OK (see image below)
    FLASH nRF5340
    Have you any idea to solve this problem ?
    Kind Regards
    Patrice
Reply
  • Hi Torbjørn,

    I have the same issue !

    I've just reinstall the latest nRF Connect SDK (v2.3.0) and still have the issue. I've set the HEAP, WORKQUEUE_STACK and RPC_THREAD_STACK sizes to 8192. The project builds successfully, but still the same error at runtime : 

    [00:00:01.457,550] <err> bt_hci_driver: Endpoint binding failed with -11
    [00:00:01.457,580] <err> bt_hci_core: HCI driver open failed (-11)

    So for me the trick of deleting the ncs folder does not work...

    I've tried to track the issue and the error appears at line 3731 of hci_core.c:

    err = bt_dev.drv->open();
    where the open() method returns the value -11 (No more contexts ?)

    I also have checked that both core are flashed using nRF Connect Desktop. It seems to be OK (see image below)
    FLASH nRF5340
    Have you any idea to solve this problem ?
    Kind Regards
    Patrice
Children
  • Hi Patrice

    Next time please open a new ticket, and add a link to the old one, so we can keep the different cases separate. 

    What version of the nRF5340DK do you have? 

    Which example are you trying to run?

    Could you try to do a recover of the board and flash it again to see if it makes a difference? 

    The quickest way to do a recover is to run nrfjprog --recover from the command line. 

    Best regards
    Torbjørn

  • Hello Torbjørn,

    Sorry for the ticket... Do you want me to open a new ticket ?

    I'm using a nRF5340-DK v2.0.0 with the latest nRF Connect SDK (v2.3.0) and I'm running the Peripheral UART example from <ncs_path>/nrf/samples/bluetooth/peripheral_uart

    ... and no difference after a recover, still the same error:

    [00:00:00.270,599] <inf> fs_nvs: 2 Sectors of 4096 bytes
    [00:00:00.270,629] <inf> fs_nvs: alloc wra: 0, fe8
    [00:00:00.270,629] <inf> fs_nvs: data wra: 0, 0
    [00:00:01.270,935] <err> bt_hci_driver: Endpoint binding failed with -11
    [00:00:01.270,965] <err> bt_hci_core: HCI driver open failed (-11)

    I investigate a bit more where the problem comes from... In my configuration, the line 311 of rpms.c returns error -11 !

    err = k_sem_take(&ipc_bound_sem, IPC_BOUND_TIMEOUT_IN_MS);

    Kind Regards

    Patrice

  • Hi Patrice

    Patrice Rudaz said:
    Sorry for the ticket... Do you want me to open a new ticket ?

    No need, just a heads up for next time Wink

    It seems somehow the network core is not properly programmed. 

    You made no changes to the sample at all, simply built it for the nrf5340? 

    Which board did you build for? 

    Are you able to show me the terminal log you get when you flash the example from VSCode? 

    Could you run nrfjprog -v from the command line and let me know what you get? 

    Best regards
    Torbjørn

  • Hi Torbjørn,

    - I had to modify the prj.conf to let it compile for the nRF5340, as described in the documentation (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/rpc_host/README.html)

    - I build the project for the nRF5340_nrf5340dk_cpuapp, the part for nrf5340_net core is done automatically 

    - Here is the terminal log of VSCode:

    Flashing build to 960157976
    /bin/sh -c west flash -d /opt/nordic/ncs/v2.3.0/nrf/samples/bluetooth/peripheral_uart/build --skip-rebuild --dev-id 960157976

    -- west flash: using runner nrfjprog
    -- runners.nrfjprog: Flashing file: /opt/nordic/ncs/v2.3.0/nrf/samples/bluetooth/peripheral_uart/build/zephyr/merged_domains.hex
    -- runners.nrfjprog: /opt/nordic/ncs/v2.3.0/nrf/samples/bluetooth/peripheral_uart/build/zephyr/merged_domains.hex targets both nRF53 coprocessors; splitting it into: /opt/nordic/ncs/v2.3.0/nrf/samples/bluetooth/peripheral_uart/build/zephyr/GENERATED_CP_NETWORK_merged_domains.hex and /opt/nordic/ncs/v2.3.0/nrf/samples/bluetooth/peripheral_uart/build/zephyr/GENERATED_CP_APPLICATION_merged_domains.hex
    [ #################### ] 12.526s | Erase file - Done erasing
    [ #################### ] 1.460s | Program file - Done programming
    [ #################### ] 1.484s | Verify file - Done verifying
    [ #################### ] 6.858s | Erase file - Done erasing
    [ #################### ] 1.672s | Program file - Done programming
    [ #################### ] 1.692s | Verify file - Done verifying
    Applying pin reset.
    -- runners.nrfjprog: Board with serial number 960157976 flashed successfully.
    * Terminal will be reused by tasks, press any key to close it.

    - And the result of nrfjprog -v:

    patrice@rutMBProT peripheral_uart % nrfjprog -v
    nrfjprog version: 10.21.0 external
    JLinkARM.dll version: 7.80c

    Kind Regards
    Patrice

  • Hi Torbjørn,

    The doc of the "Host for nRF RPC Bluetooth Low Energy" says to enable CONFIG_BT_RPC_STACK to build the example (Peripheral_UART, for me). It also says that the configurations of the application must be the same of those of the host_rpc one.

    So, I added the CONFIG_BT_* of the host_rpc project to the prj.conf of the UART example. I also added the CONFIG_BT_RPC_STACK=y in the prj.conf, as it is said in the documentation. And the project won't compile with this configuration. The output of the compiler is the following:

    /opt/nordic/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/entropy/libdrivers__entropy.a(entropy_bt_hci.c.obj): in function `entropy_bt_get_entropy':
    /opt/nordic/ncs/v2.3.0/zephyr/drivers/entropy/entropy_bt_hci.c:27: undefined reference to `bt_hci_le_rand'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/v2.3.0/bin/cmake --build /opt/nordic/ncs/v2.3.0/nrf/samples/bluetooth/peripheral_uart/nrf5340_build

    My feeling is that the configuration of the two projects is not correct. I am attaching the two .conf files for your verification. (The configuration file for the host_rpc project is prj.conf and the one for UART example is  prj_ble_rpc.conf)
    7026.prj.confprj_ble_rpc.conf

    Kind Regards
    Patrice

Related