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.

  • 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

  • Hi again,

    So, I make it run !

    I've started again with original prj.conf files coming from acs v2.1.0, ignoring all instruction of the documentation:
    - not added CONFIG_BT_RPC_STACK
    - no check of "same configuration" between both project

    And it compiles and run !

    I'm sorry to have disturb you for that problem. Some times you have to read and follow recommendations and sometime not ;-)

    Kind regards
    Patrice

Reply Children
  • Hi Patrice

    Good to hear you found a solution in the end, but if the documentation is incorrect it sounds like something we should look into.

    I also had some issues building the peripheral_uart sample when I added CONFIG_BT_RPC_STACK=y to prj.conf, but I got it to work when building from command line as described in the documentation. According to the developers it should work fine to add the configuration in prj.conf, so I need to spend some more time with this to figure out what is going on. 

    Unfortunately I am quite busy this week, but I will set aside some time next week to investigate further. 

    Best regards
    Torbjørn

  • Hi again

    Sorry for the late return Wink

    It seems the issue in my case was that I forgot to do a pristine build after adding CONFIG_BT_RPC_STACK=y to prj.conf, which caused a conflict between the default hci_rpmsg child image and the rpc_host child image...

    Once I made sure to do a pristine build I had no issue running the sample with the configuration set in prj.conf. 

    Best regards
    Torbjørn

Related