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.

Reply
  • 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.

Children
  • 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
  • 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

Related