Direction finding connectionless sample doesn't work on my nrf5340dk

Hello!

I will start by saying that I am new to embedded software development, and new to nrf boards in general.

After successfully running the direction finding connectionless (rx and tx) samples on my nrf52833dk, I want to run it on my nrf5340dk. I ran into a difficult issue when trying to flash the bluetooth controller on the network core. I think I followed the exact steps that are specified in the README of https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/bluetooth/direction_finding_connectionless_rx#id5

I copied the .overlay file with the pin configuration into the hci-rpmsg sample and modified it accordingly, and then I copied the .conf file from the direction_finding_connectionless boards folder and changed its name such that it configures the cpunet (like the README says). When I try to flash the code for the cpunet, it seems that there is not enough RAM on the network core. (It says that I overflowed by around 20 kilobytes)

I then tried flashing the hci-rpmsg sample unmodified, and saw that by itself it was allocating ~60% of the 64kB of RAM. (Which was already a bit surprising to me)

It seems that when pasting and modifying the .conf file from the direction_finding_connectionless_rx (same happens with tx, except it overflows with about 12kB) the RAM overflows by quite a lot (So I can't just cut some of the 8kB of heap memory because it wouldn t be enough), which is weird and it leads me to believe I am doing something very wrong. Perhaps I don't need all the settings that are in there? I did try to play around with the settings in the hope it would work but I am now completely stuck.

Any help or tips would be greatly appreciated!

Parents
  • Hi,

    Since you have recently started with embedded software development, you can read about multi-image builds in the documentation. I would recommend that you use nrf samples for direction finding with some of the most recent versions of NCS. Relevant samples are direction finding connectionless locator and direction finding connectionless beacon.

    Best regards,
    Dejan

  • Hello! 

    Thank you for your advice, I have read everything I found useful about multi-image builds (including of course the link you provided). I also tried to run the samples you recommended in every way I possibly could have.

    At first, I was flashing the direction finding connectionless locator code on the app core separately, and then I flashed the hci_rpmsg sample on the network core, which I expected to work but I get an error saying the RAM overflows by 26600.

    After reading your response I set things up so that the rci_rpmsg is a child image, and it didn't make any difference. I could really use some specific advice on this, perhaps you could try to replicate my error, or just take a quick look at the settings I added to the hci_rpmsg. (since it builds without them, and after I add them the memory overflows by a lot, but I get a runtime error if I run the controller without any/all the settings here)

    EDIT: Some things to add:

    * I am using the latest version of ncs (main)

    * These are the settings I am using in the .conf file of the hci_rpmsg bluetooth controller:

    CONFIG_BT_CTLR=y                                        
    CONFIG_BT_LL_SW_SPLIT=y                                 
                                                            
    CONFIG_BT_CTLR_ADV_EXT=y                                
    CONFIG_BT_CTLR_SYNC_PERIODIC=y                          
                                                            
    # Enable Direction Finding Feature including AoA and AoD
    CONFIG_BT_CTLR_DF=y                                     
                                                            
    # Disable Direction Finding TX mode                     
    CONFIG_BT_CTLR_DF_ANT_SWITCH_TX=n                       
    CONFIG_BT_CTLR_DF_ADV_CTE_TX=n                          
                                                            
    CONFIG_BT_CTLR_DF_PER_SCAN_CTE_NUM_MAX=16               
    CONFIG_BT_PER_ADV_SYNC=y                                
    CONFIG_BT_EXT_ADV=y    

  • Hi,

    Currently, the latest version of NCS is v2.1.2 and it should be used instead of main.

    Could you please show the error that you get? At which point does the error appear?

    Could you provide list of all necessary steps so that I could try to reproduce the issue?

    Best regards,
    Dejan

  • Hello! 

    Thank you for all your responses!

    I have switched to v2.1.2 as you suggested. I will list every step I took:

    First I installed ncs doing everything this documentation said, and I installed ncs v2.1.2: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_installing.html.

    Note: you don't even need an nrf board to replicate this, since the error appears when building, so there is no need to try to flash.

    Then I added the following two files in ncs/zephyr/samples/bluetooth/hci_rpmsg/boards :
    nrf5340dk_nrf5340_cpunet.conf

    CONFIG_BT_CTLR=y                                                                 
    CONFIG_BT_LL_SW_SPLIT=y                                                          
                                                                                     
    CONFIG_BT_CTLR_ADV_EXT=y                                                         
    CONFIG_BT_CTLR_SYNC_PERIODIC=y                                                   
                                                                                     
    # Enable Direction Finding Feature including AoA and AoD                         
    CONFIG_BT_CTLR_DF=y                                                              
                                                                                     
    # Disable Direction Finding TX mode                                              
    CONFIG_BT_CTLR_DF_ANT_SWITCH_TX=n                                                
    CONFIG_BT_CTLR_DF_ADV_CTE_TX=n                                                   
                                                                                     
    CONFIG_BT_CTLR_DF_PER_SCAN_CTE_NUM_MAX=16                                        
    CONFIG_BT_PER_ADV_SYNC=y                                                         
    CONFIG_BT_EXT_ADV=y


    nrf5340dk_nrf5340_cpunet.overlay
     
    &radio {                                                                         
        status = "okay";                                                             
        /* This is an example number of antennas that may be available               
         * on antenna matrix board.                                                  
         */                                                                          
        dfe-antenna-num = <12>;                                                      
        /* This is an example switch pattern that will be used to set an             
         * antenna for Tx PDU (period before start of Tx CTE).                       
         */                                                                          
        dfe-pdu-antenna = <0x1>;                                                     
                                                                                     
        /* These are example GPIO pin numbers that are provided to                   
         * Radio peripheral. The pins will be acquired by Radio to                   
         * drive antenna switching when AoD is enabled.                              
         */                                                                          
        dfegpio0-gpios = <&gpio0 4 0>;                                               
        dfegpio1-gpios = <&gpio0 5 0>;                                               
        dfegpio2-gpios = <&gpio0 6 0>;                                               
        dfegpio3-gpios = <&gpio0 7 0>;                                               
    }; 

    After which I ran the following command in the directory ~/ncs/zephyr :

    west build -p auto -b nrf5340dk_nrf5340_cpuapp ~/ncs/zephyr/samples/bluetooth/di
    rection_finding_connectionless_rx

    I will paste here the entire output of the console:

    -- west build: making build dir /home/filipang/ncs/zephyr/build pristine
    -- west build: generating a build system                                                                                                                                                                                                    
    Loading Zephyr default modules (Zephyr base).
    -- Application: /home/filipang/ncs/zephyr/samples/bluetooth/direction_finding_connectionless_rx
    -- Found Python3: /usr/bin/python3.9 (found suitable exact version "3.9.2") found components: Interpreter 
    -- Cache files will be written to: /home/filipang/.cache/zephyr
    -- Zephyr version: 3.1.99 (/home/filipang/ncs/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf5340dk_nrf5340_cpuapp
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.15.1 (/home/filipang/zephyr-sdk-0.15.1)
    -- Found dtc: /home/filipang/zephyr-sdk-0.15.1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
    -- Found toolchain: zephyr 0.15.1 (/home/filipang/zephyr-sdk-0.15.1)
    -- Found BOARD.dts: /home/filipang/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: /home/filipang/ncs/zephyr/samples/bluetooth/direction_finding_connectionless_rx/boards/nrf5340dk_nrf5340_cpuapp.overlay
    -- Generated zephyr.dts: /home/filipang/ncs/zephyr/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/filipang/ncs/zephyr/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/filipang/ncs/zephyr/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/filipang/ncs/zephyr/build/zephyr/dts.cmake
    
    warning: Experimental symbol BT_DF is enabled.
    
    Parsing /home/filipang/ncs/zephyr/samples/bluetooth/direction_finding_connectionless_rx/Kconfig
    Loaded configuration '/home/filipang/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
    Merged configuration '/home/filipang/ncs/zephyr/samples/bluetooth/direction_finding_connectionless_rx/prj.conf'
    Configuration saved to '/home/filipang/ncs/zephyr/build/zephyr/.config'
    Kconfig header saved to '/home/filipang/ncs/zephyr/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 12.1.0
    -- The CXX compiler identification is GNU 12.1.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/filipang/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    
    === child image hci_rpmsg - CPUNET begin ===
    loading initial cache file /home/filipang/ncs/zephyr/build/hci_rpmsg/child_image_preload.cmake
    Loading Zephyr default modules (Zephyr base).
    -- Application: /home/filipang/ncs/zephyr/samples/bluetooth/hci_rpmsg
    -- Found Python3: /usr/bin/python3.9 (found suitable exact version "3.9.2") found components: Interpreter 
    -- Cache files will be written to: /home/filipang/.cache/zephyr
    -- Zephyr version: 3.1.99 (/home/filipang/ncs/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf5340dk_nrf5340_cpunet
    -- Found host-tools: zephyr 0.15.1 (/home/filipang/zephyr-sdk-0.15.1)
    -- Found dtc: /home/filipang/zephyr-sdk-0.15.1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
    -- Found toolchain: zephyr 0.15.1 (/home/filipang/zephyr-sdk-0.15.1)
    -- Found BOARD.dts: /home/filipang/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts
    -- Found devicetree overlay: /home/filipang/ncs/zephyr/samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay
    -- Generated zephyr.dts: /home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/dts.cmake
    
    warning: Experimental symbol BT_LL_SW_SPLIT is enabled.
    
    
    warning: Experimental symbol BT_LL_SW_LLCP is enabled.
    
    Parsing /home/filipang/ncs/zephyr/Kconfig
    Loaded configuration '/home/filipang/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet_defconfig'
    Merged configuration '/home/filipang/ncs/zephyr/samples/bluetooth/hci_rpmsg/prj.conf'
    Merged configuration '/home/filipang/ncs/zephyr/samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.conf'
    Merged configuration '/home/filipang/ncs/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Configuration saved to '/home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/.config'
    Kconfig header saved to '/home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 12.1.0
    -- The CXX compiler identification is GNU 12.1.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/filipang/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- libmetal version: 1.2.0 (/home/filipang/ncs/zephyr/samples/bluetooth/hci_rpmsg)
    -- Build type:  
    -- Host:    Linux/x86_64
    -- Target:  Generic/arm
    -- Machine: arm
    -- Looking for include file stdatomic.h
    -- Looking for include file stdatomic.h - found
    -- open-amp version: 1.2.0 (/home/filipang/ncs/modules/lib/open-amp/open-amp)
    -- Host:    Linux/x86_64
    -- Target:  Generic/arm
    -- Machine: arm
    -- C_FLAGS :  -Wall -Wextra
    -- Looking for include file fcntl.h
    -- Looking for include file fcntl.h - found
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/filipang/ncs/zephyr/build/hci_rpmsg
    === child image hci_rpmsg - CPUNET end ===
    
    -- libmetal version: 1.2.0 (/home/filipang/ncs/zephyr/samples/bluetooth/direction_finding_connectionless_rx)
    -- Build type:  
    -- Host:    Linux/x86_64
    -- Target:  Generic/arm
    -- Machine: arm
    -- Looking for include file stdatomic.h
    -- Looking for include file stdatomic.h - found
    -- open-amp version: 1.2.0 (/home/filipang/ncs/modules/lib/open-amp/open-amp)
    -- Host:    Linux/x86_64
    -- Target:  Generic/arm
    -- Machine: arm
    -- C_FLAGS :  -Wall -Wextra
    -- Looking for include file fcntl.h
    -- Looking for include file fcntl.h - found
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/filipang/ncs/zephyr/build
    -- west build: building application
    [1/247] Preparing syscall dependency handling
    
    [3/247] Generating include/generated/version.h
    -- Zephyr version: 3.1.99 (/home/filipang/ncs/zephyr), build: v3.1.99-ncs1-1
    [7/247] Performing build step for 'hci_rpmsg_subimage'
    [1/278] Preparing syscall dependency handling
    
    [2/278] Generating include/generated/version.h
    -- Zephyr version: 3.1.99 (/home/filipang/ncs/zephyr), build: v3.1.99-ncs1-1
    [82/278] Building C object zephyr/arch/arch/arm/core/aarch32/mpu/CMakeFiles/arch__arm__core__aarch32__mpu.dir/arm_core_mpu.c.obj
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c: In function 'z_arm_configure_dynamic_mpu_regions':
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: warning: 'arm_core_mpu_configure_dynamic_mpu_regions' reading 12 bytes from a region of size 0 [-Wstringop-overread]
      311 |         arm_core_mpu_configure_dynamic_mpu_regions(dynamic_regions,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      312 |                                                    region_num);
          |                                                    ~~~~~~~~~~~
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: note: referencing argument 1 of type 'const struct z_arm_mpu_partition[0]'
    In file included from /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:12:
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu_dev.h:187:6: note: in a call to function 'arm_core_mpu_configure_dynamic_mpu_regions'
      187 | void arm_core_mpu_configure_dynamic_mpu_regions(
          |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: warning: 'arm_core_mpu_configure_dynamic_mpu_regions' reading 12 bytes from a region of size 0 [-Wstringop-overread]
      311 |         arm_core_mpu_configure_dynamic_mpu_regions(dynamic_regions,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      312 |                                                    region_num);
          |                                                    ~~~~~~~~~~~
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: note: referencing argument 1 of type 'const struct z_arm_mpu_partition[0]'
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu_dev.h:187:6: note: in a call to function 'arm_core_mpu_configure_dynamic_mpu_regions'
      187 | void arm_core_mpu_configure_dynamic_mpu_regions(
          |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: warning: 'arm_core_mpu_configure_dynamic_mpu_regions' reading 12 bytes from a region of size 0 [-Wstringop-overread]
      311 |         arm_core_mpu_configure_dynamic_mpu_regions(dynamic_regions,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      312 |                                                    region_num);
          |                                                    ~~~~~~~~~~~
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: note: referencing argument 1 of type 'const struct z_arm_mpu_partition[0]'
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu_dev.h:187:6: note: in a call to function 'arm_core_mpu_configure_dynamic_mpu_regions'
      187 | void arm_core_mpu_configure_dynamic_mpu_regions(
          |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [266/278] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/zephyr_pre0.map 
    : && ccache /home/filipang/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc   zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a  zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/subsys/bluetooth/common/libsubsys__bluetooth__common.a  zephyr/subsys/bluetooth/host/libsubsys__bluetooth__host.a  zephyr/subsys/bluetooth/controller/libsubsys__bluetooth__controller.a  zephyr/subsys/net/libsubsys__net.a  zephyr/subsys/random/libsubsys__random.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/entropy/libdrivers__entropy.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/mbox/libdrivers__mbox.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/libmetal/libmetal/lib/libmetal.a  modules/open-amp/open-amp/lib/libopen_amp.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/home/filipang/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v8-m.main/nofp"  -L/home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -no-pie  -mcpu=cortex-m33+nodsp  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn && cd /home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr && /usr/local/bin/cmake -E echo
    /home/filipang/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `bss' will not fit in region `SRAM'
    /home/filipang/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `SRAM' overflowed by 30396 bytes
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [95/247] Building C object zephyr/arch/arch/arm/core/aarch32/mpu/CMakeFiles/arch__arm__core__aarch32__mpu.dir/arm_core_mpu.c.obj
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c: In function 'z_arm_configure_dynamic_mpu_regions':
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: warning: 'arm_core_mpu_configure_dynamic_mpu_regions' reading 12 bytes from a region of size 0 [-Wstringop-overread]
      311 |         arm_core_mpu_configure_dynamic_mpu_regions(dynamic_regions,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      312 |                                                    region_num);
          |                                                    ~~~~~~~~~~~
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: note: referencing argument 1 of type 'const struct z_arm_mpu_partition[0]'
    In file included from /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:12:
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu_dev.h:187:6: note: in a call to function 'arm_core_mpu_configure_dynamic_mpu_regions'
      187 | void arm_core_mpu_configure_dynamic_mpu_regions(
          |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: warning: 'arm_core_mpu_configure_dynamic_mpu_regions' reading 12 bytes from a region of size 0 [-Wstringop-overread]
      311 |         arm_core_mpu_configure_dynamic_mpu_regions(dynamic_regions,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      312 |                                                    region_num);
          |                                                    ~~~~~~~~~~~
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: note: referencing argument 1 of type 'const struct z_arm_mpu_partition[0]'
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu_dev.h:187:6: note: in a call to function 'arm_core_mpu_configure_dynamic_mpu_regions'
      187 | void arm_core_mpu_configure_dynamic_mpu_regions(
          |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: warning: 'arm_core_mpu_configure_dynamic_mpu_regions' reading 12 bytes from a region of size 0 [-Wstringop-overread]
      311 |         arm_core_mpu_configure_dynamic_mpu_regions(dynamic_regions,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      312 |                                                    region_num);
          |                                                    ~~~~~~~~~~~
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu.c:311:9: note: referencing argument 1 of type 'const struct z_arm_mpu_partition[0]'
    /home/filipang/ncs/zephyr/arch/arm/core/aarch32/mpu/arm_core_mpu_dev.h:187:6: note: in a call to function 'arm_core_mpu_configure_dynamic_mpu_regions'
      187 | void arm_core_mpu_configure_dynamic_mpu_regions(
          |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [232/247] Linking C executable zephyr/zephyr_pre0.elf
    
    [232/247] Generating dev_handles.c
    FAILED: modules/nrf/samples/hci_rpmsg_subimage-prefix/src/hci_rpmsg_subimage-stamp/hci_rpmsg_subimage-build hci_rpmsg/zephyr/zephyr.hex hci_rpmsg/zephyr/zephyr.elf hci_rpmsg/zephyr/merged_CPUNET.hex /home/filipang/ncs/zephyr/build/modules/nrf/samples/hci_rpmsg_subimage-prefix/src/hci_rpmsg_subimage-stamp/hci_rpmsg_subimage-build /home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/zephyr.hex /home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/zephyr.elf /home/filipang/ncs/zephyr/build/hci_rpmsg/zephyr/merged_CPUNET.hex 
    cd /home/filipang/ncs/zephyr/build/hci_rpmsg && /usr/local/bin/cmake --build . --
    [234/247] Generating dev_handles.c
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /usr/local/bin/cmake --build /home/filipang/ncs/zephyr/build

    As you can see on on lines 145-148, the allocated SRAM overflows the region by 30kB.

    (Small note, when I was using main branch, before switching to v2.1.2, it the same thing was happening, except it said RAM instead of SRAM. There are also some warnings that don't appear on main branch, but they don't seem to affect anything anyway.)

    Again thank you so much for your help!

    Best regards,

    Filip Angheluta.

    EDIT: One final thing to add, I am running linux (debian bullseye) and did everything from command line.

  • Hi,

    If you are using Angle of Arrival (AoA), then you should have 

    dfe-pdu-antenna = <0x0>;


    instead of 

    dfe-pdu-antenna = <0x1>; 


    in your nrf5340dk_nrf5340_cpunet.overlay file.

    With NCS v2.1.2 you do not need to copy files manually or do any manual changes. You should be able to build unmodified direction_finding_locator sample without issues. In addition to mentioned change in the overlay file, after building you will get hci_rpmsg.conf file in your child_image folder instead of nrf5340dk_nrf5340_cpunet.conf which is no longer needed.

    Best regards,
    Dejan

  • Hello,

    Should the child_image/hci_rpmsg.conf file appear by itself? Because for me it does not when I build. (And there is no child_image folder either)

    I removed the two files I added manually (so now the hci_rpmsg sample is unmodified), and building the direction_finding_locator sample works (This happened before so nothing new here, I assumed that I needed those configurations to get it to work, which I added because it is what the readme says), but when I flash it on the nrf5340dk I get the following error:

    Waiting for periodic advertising...*** Booting Zephyr OS build v3.1.99-ncs1-1  ***
    Starting Connectionless Locator Demo
    Bluetooth initialization...success
    Scan callbacks register...success.
    Periodic Advertising callbacks register...success.
    Start scanning...failed (err -5)
    Waiting for periodic advertising...
    
    


    Whereas when I run it on my nrf52833dk (Exact same setup and sample except I use the command for the nrf52) everything works exactly as expected.

    Is the following section from the sample README not up to date? Because these are the exact steps I followed and it does not work for me due to that memory overflow issue.

    To run the application on nRF5340DK, a Bluetooth controller application must     
    also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample       
    application may be used. To build this sample with direction finding support     
    enabled:                                                                         
                                                                                     
    * Copy                                                                           
      :zephyr_file:`samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52833.overlay`
      to a new file,                                                                 
      :file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`.   
    * Make sure the same GPIO pins are assigned to Direction Finding Extension in file
      :zephyr_file:`samples/bluetooth/direction_finding_connectionless_rx/boards/nrf5340dk_nrf5340_cpuapp.overlay`.
      as those in the created file :file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`.
    * Copy                                                                           
      :zephyr_file:`samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52833.conf`
      to a new file,                                                                 
      :file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.conf`. Add  
      the line ``CONFIG_BT_EXT_ADV=y`` to enable extended size of                    
      :kconfig:option:`CONFIG_BT_BUF_CMD_TX_SIZE` to support the LE Set Extended Advertising
      Data command.                                                        


    Perhaps you could explain what exactly is wrong with the steps I took, because I don't seem to be making any progress with this problem by myself. From what I understood before you said I don't need the .conf file, which I worm but it still doesn't work. like it does on the nrf52833dk. Maybe it has something to do with the child_image folder that I don't have.

    Best regards,

    Filip.

  • Hi Filip,

    It might be that you are using Zephyr sample instead of nrf sample. When creating freestanding application in VS Code choose application template to be nrf\samples\direction_finding_connectionless_rx. I have tested using nrf sample. Folder child_image is automatically created in your application directory and includes hci_rpmsg.conf file.

    Best regards,
    Dejan

Reply
  • Hi Filip,

    It might be that you are using Zephyr sample instead of nrf sample. When creating freestanding application in VS Code choose application template to be nrf\samples\direction_finding_connectionless_rx. I have tested using nrf sample. Folder child_image is automatically created in your application directory and includes hci_rpmsg.conf file.

    Best regards,
    Dejan

Children
Related