nrf5340DK Custom board fails creation via VSCode extension

Hi,

I am starting from the following example: "Bluetooth Low Energy UART service sample", sdk version v2.6.0
I am trying to add a custom board (using VSCode NRF CONNECT extension). The creation works, I get the files in (project-path)/boards/arm/my-custom-board but this configuration is unable to build and I get the following error that I'm unable to understand and fix.

warning: UART_CONSOLE (defined at drivers/console/Kconfig:43) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: SERIAL_HAS_DRIVER (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_UART_CONSOLE and/or look up UART_CONSOLE in
the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


warning: UART_ASYNC_API (defined at drivers/serial/Kconfig:66) was assigned the value 'y' but got
the value 'n'. Check these unsatisfied dependencies: SERIAL_SUPPORT_ASYNC (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_UART_ASYNC_API and/or look up
UART_ASYNC_API in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.


/Users/work/5340-can-ble/can-ble/boards/arm/can_ble_board/can_ble_board_cpuapp_ns_defconfig:12: warning: ignoring malformed line 'UART_CONSOLE=y'

/Users/work/5340-can-ble/can-ble/boards/arm/can_ble_board/can_ble_board_cpuapp_ns_defconfig:13: warning: ignoring malformed line 'UART_ASYNC_API=y'

error: Aborting due to Kconfig warnings
.............<some output that's irrelevant>............
CMake Error at /opt/nordic/ncs/v2.6.0/nrf/cmake/multi_image.cmake:208 (message):
  No board specified for domain 'CPUNET'.  This configuration is typically
  defined in
  /Users/work/5340-can-ble/can-ble/boards/arm/can_ble_board/Kconfig
Call Stack (most recent call first):
  /opt/nordic/ncs/v2.6.0/nrf/cmake/multi_image.cmake:178 (add_child_image_from_source)
  /opt/nordic/ncs/v2.6.0/nrf/samples/CMakeLists.txt:148 (add_child_image)


-- Configuring incomplete, errors occurred!

Parents
  • As a general ideea as to where I am trying to get.

    I have a 5340DK that right now runs an app I wrote and interacts with some peripherals via iic and spi. The data is processed and sent via UART to a PC.
    I want to send that data from the 5340DK to a mobile phone via BLE therefore I am looking at the BLE UART service sample as a reference to get me started. Therefore, I thought that having a custom board config in the BLE UART service example would be a good first step to figure out what prj.conf/Kconfig/etc. modifications I need to make in my app to enable BLE.

    If I go the other way around and I try to set the BLE specific configs to my non-BLE iic/spi peripherals only project

    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Nordic_UART_Service"
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_MAX_PAIRED=1
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
     by adding these configurations to my
    - prj.conf
    - custom_board_nrf5340_cpuapp_defconfig
    - custom_board_nrf5340_cpuapp_ns_defconfig
    - custom_board_nrf5340_cpunet_defconfig

    It appears to me that still there are not enough to inficate my config since I get other errors (no code changes, just configs)
    FAILED: zephyr/CMakeFiles/zephyr.dir/opt/nordic/ncs/v2.6.0/nrf/subsys/bluetooth/services/nus.c.obj 
    ccache /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DNRF5340_XXAA_NETWORK -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/opt/nordic/ncs/v2.6.0/zephyr/kernel/include -I/opt/nordic/ncs/v2.6.0/zephyr/arch/arm/include -I/opt/nordic/ncs/v2.6.0/nrf/drivers/mpsl/clock_control -I/opt/nordic/ncs/v2.6.0/zephyr/include -I/Users/work/5340-iic-scanner/s/build/hci_ipc/zephyr/include/generated -I/opt/nordic/ncs/v2.6.0/zephyr/soc/arm/nordic_nrf/nrf53 -I/opt/nordic/ncs/v2.6.0/zephyr/soc/common/nordic_nrf/. -I/opt/nordic/ncs/v2.6.0/zephyr/soc/arm/nordic_nrf/common/. -I/opt/nordic/ncs/v2.6.0/zephyr/subsys/bluetooth -I/opt/nordic/ncs/v2.6.0/zephyr/subsys/settings/include -I/opt/nordic/ncs/v2.6.0/nrf/include -I/opt/nordic/ncs/v2.6.0/nrf/lib/multithreading_lock/. -I/opt/nordic/ncs/v2.6.0/nrf/subsys/bluetooth/controller/. -I/opt/nordic/ncs/v2.6.0/zephyr/drivers/flash -I/opt/nordic/ncs/v2.6.0/nrf/tests/include -I/opt/nordic/ncs/v2.6.0/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v2.6.0/zephyr/modules/cmsis/. -I/opt/nordic/ncs/v2.6.0/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v2.6.0/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v2.6.0/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v2.6.0/zephyr/modules/hal_nordic/nrfx/. -I/Users/work/5340-iic-scanner/s/build/hci_ipc/modules/libmetal/libmetal/lib/include -I/opt/nordic/ncs/v2.6.0/modules/lib/open-amp/open-amp/lib/include -I/opt/nordic/ncs/v2.6.0/modules/crypto/tinycrypt/lib/include -I/opt/nordic/ncs/v2.6.0/nrfxlib/mpsl/fem/common/include -I/opt/nordic/ncs/v2.6.0/nrfxlib/mpsl/fem/nrf21540_gpio/include -I/opt/nordic/ncs/v2.6.0/nrfxlib/mpsl/fem/nrf21540_gpio_spi/include -I/opt/nordic/ncs/v2.6.0/nrfxlib/mpsl/fem/simple_gpio/include -I/opt/nordic/ncs/v2.6.0/nrfxlib/mpsl/fem/include -I/opt/nordic/ncs/v2.6.0/nrfxlib/mpsl/fem/include/protocol -I/opt/nordic/ncs/v2.6.0/nrfxlib/mpsl/include -I/opt/nordic/ncs/v2.6.0/nrfxlib/mpsl/include/protocol -I/opt/nordic/ncs/v2.6.0/nrfxlib/softdevice_controller/include -isystem /opt/nordic/ncs/v2.6.0/zephyr/lib/libc/common/include -fno-strict-aliasing -Os -imacros /Users/work/5340-iic-scanner/s/build/hci_ipc/zephyr/include/generated/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33+nodsp -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros /opt/nordic/ncs/v2.6.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/opt/nordic/ncs/v2.6.0/zephyr/samples/bluetooth/hci_ipc=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v2.6.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v2.6.0=WEST_TOPDIR -ffunction-sections -fdata-sections --specs=picolibc.specs -std=c99 -MD -MT zephyr/CMakeFiles/zephyr.dir/opt/nordic/ncs/v2.6.0/nrf/subsys/bluetooth/services/nus.c.obj -MF zephyr/CMakeFiles/zephyr.dir/opt/nordic/ncs/v2.6.0/nrf/subsys/bluetooth/services/nus.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/opt/nordic/ncs/v2.6.0/nrf/subsys/bluetooth/services/nus.c.obj -c /opt/nordic/ncs/v2.6.0/nrf/subsys/bluetooth/services/nus.c
    In file included from /opt/nordic/ncs/v2.6.0/nrf/subsys/bluetooth/services/nus.c:9:
    /opt/nordic/ncs/v2.6.0/zephyr/include/zephyr/bluetooth/gatt.h:780:34: error: 'CONFIG_BT_MAX_PAIRED' undeclared here (not in a function); did you mean 'CONFIG_BT_RX_PRIO'?
      780 |         #define BT_GATT_CCC_MAX (CONFIG_BT_MAX_PAIRED + CONFIG_BT_MAX_CONN)
          |                                  ^~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.6.0/zephyr/include/zephyr/bluetooth/gatt.h:798:36: note: in expansion of macro 'BT_GATT_CCC_MAX'
      798 |         struct bt_gatt_ccc_cfg cfg[BT_GATT_CCC_MAX];
          |                                    ^~~~~~~~~~~~~~~
    [97/230] Building C object zephyr/subsys/random/CMakeFiles/subsys__random.dir/rand32_entropy_device.c.obj
    [98/230] Building C object zephyr/subsys/bluetooth/common/CMakeFiles/subsys__bluetooth__common.dir/dummy.c.obj
    [99/230] Building C object CMakeFiles/app.dir/src/main.c.obj
    [100/230] Building C object zephyr/subsys/bluetooth/common/CMakeFiles/subsys__bluetooth__common.dir/bt_str.c.obj
    [101/230] Building C object zephyr/arch/arch/arm/core/mpu/CMakeFiles/arch__arm__core__mpu.dir/arm_mpu.c.obj
    [102/230] Building C object zephyr/subsys/bluetooth/common/CMakeFiles/subsys__bluetooth__common.dir/rpa.c.obj
    [103/230] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/hci_common.c.obj
    [104/230] Building C object zephyr/subsys/net/CMakeFiles/subsys__net.dir/buf_simple.c.obj
    [105/230] Building C object zephyr/subsys/net/CMakeFiles/subsys__net.dir/buf.c.obj
    [106/230] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/hci_raw.c.obj
    [107/230] Building C object zephyr/soc/soc/arm/nordic_nrf/CMakeFiles/soc__arm__nordic_nrf.dir/nrf53/soc.c.obj
    ninja: build stopped: subcommand failed.
    [14/354] Generating ../../tfm/CMakeCache.txt
    CMake Warning at cmake/version.cmake:22 (message):
      Actual TF-M version is not available from Git repository.  Settled to
      v2.0.0
    Call Stack (most recent call first):
      CMakeLists.txt:22 (include)
    
    
    -- Found Git: /opt/nordic/ncs/toolchains/580e4ef81c/bin/git (found version "2.37.3") 
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    -- Found Python3: /opt/nordic/ncs/toolchains/580e4ef81c/opt/[email protected]/bin/python3.9 (found version "3.9.6") found components: Interpreter 
    CMake Deprecation Warning at /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/FindDeprecated.cmake:121 (message):
      'PYTHON_PREFER' variable is deprecated.  Please use Python3_EXECUTABLE
      instead.
    Call Stack (most recent call first):
      /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/python.cmake:16 (find_package)
      /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/user_cache.cmake:30 (include)
      /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/extensions.cmake:5 (include)
      /opt/nordic/ncs/v2.6.0/nrf/subsys/nrf_security/tfm/CMakeLists.txt:38 (include)
    
    
    -- Found Python3: /opt/nordic/ncs/toolchains/580e4ef81c/opt/[email protected]/bin/python3.9 (found suitable version "3.9.6", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: /Users/Library/Caches/zephyr
    -- Configuring done
    -- Generating done
    CMake Warning:
      Manually-specified variables were not used by the project:
    
        CRYPTO_RNG_MODULE_ENABLED
        MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE
        PYTHON_PREFER
    
    
    -- Build files have been written to: /Users/work/5340-iic-scanner/s/build/tfm
    [19/354] No configure step for 'tfm'
    FAILED: modules/nrf/samples/hci_ipc_subimage-prefix/src/hci_ipc_subimage-stamp/hci_ipc_subimage-build hci_ipc/zephyr/zephyr.hex hci_ipc/zephyr/zephyr.elf hci_ipc/zephyr/merged_CPUNET.hex /Users/work/5340-iic-scanner/s/build/modules/nrf/samples/hci_ipc_subimage-prefix/src/hci_ipc_subimage-stamp/hci_ipc_subimage-build /Users/work/5340-iic-scanner/s/build/hci_ipc/zephyr/zephyr.hex /Users/work/5340-iic-scanner/s/build/hci_ipc/zephyr/zephyr.elf /Users/work/5340-iic-scanner/s/build/hci_ipc/zephyr/merged_CPUNET.hex 
    cd /Users/work/5340-iic-scanner/s/build/hci_ipc && /opt/nordic/ncs/toolchains/580e4ef81c/Cellar/cmake/3.21.0/bin/cmake --build . --
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/580e4ef81c/bin/cmake --build /Users/work/5340-iic-scanner/s/build
    It is unclear to me where these configurations should be added and why adding them still does not make them visible.

     

  • Hi,

    If you are using a DK, I recommend using the DK's board files and creating overlays if you want to make any changes to the devicetree rather than creating a custom board. You can look at Set devicetree overlays for more information.

    Regarding the build log, you get an error that CONFIG_BT_MAX_PAIRED is undeclared:

    /opt/nordic/ncs/v2.6.0/zephyr/include/zephyr/bluetooth/gatt.h:780:34: error: 'CONFIG_BT_MAX_PAIRED' undeclared here (not in a function); did you mean 'CONFIG_BT_RX_PRIO'?
      780 |         #define BT_GATT_CCC_MAX (CONFIG_BT_MAX_PAIRED + CONFIG_BT_MAX_CONN)
          |      

    To fix this, you must set CONFIG_BT_MAX_PAIRED in prj.conf, for example, CONFIG_BT_MAX_PAIRED=1.

    Best regards,
    Marte

  • CONFIG_BT_MAX_PAIRED=1 is present in my prj.conf as I indicated in the previous comment. Doesn't do the job.
    I will try the overlay approach and see how it does.
    Since my used version seems to be going towards legacy I will also try updating to version sdk v.2.9.0 
  • I have done the following: started a new application from the BLE UART service sample, added in all my code and done the pin configuration in a single app.overlay file.
    I no longer have compiling errors, but I am stuck on IIC not working anymore, specifically SCL which I have assigned to Port0 Pin10. SDA assigned to Port0Pin9 has signal generated on it while SCL Port0 Pin10 has nothing.
    Am I understanding correctly that Port0 Pin10 is already used by UART peripherals based on nrf5340_cpuapp_common-pinctrl.dtsi and nrf5340dk_nrf5340_cpunet-pinctrl.dtsi , but here I am confused, since in the first file it is assigned to uart1 and in the second file it is assigned to uart0. Slightly confused here.

    My app.overlay file looks like this

    /*
     * Copyright (c) 2022 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    
    &gpiote {
    	status = "okay";
    };
    
    &gpio0 {
    	status = "okay";
    };
    
    &gpio1 {
    	status = "okay";
    };
    
    
    &pinctrl {
    	i2c1_default: i2c1_default {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 0, 9)>,
    				<NRF_PSEL(TWIM_SCL, 0, 10)>;
    		};
    	};
    
    	i2c1_sleep: i2c1_sleep {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 0, 9)>,
    				<NRF_PSEL(TWIM_SCL, 0, 10)>;
    			low-power-enable;
    		};
    	};
    	
    	spi4_default: spi4_default {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 1, 14)>,
    				<NRF_PSEL(SPIM_MISO, 1, 13)>,
    				<NRF_PSEL(SPIM_MOSI, 1, 15)>;
    		};
    	};
    
    	spi4_sleep: spi4_sleep {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 1, 14)>,
    				<NRF_PSEL(SPIM_MISO, 1, 13)>,
    				<NRF_PSEL(SPIM_MOSI, 1, 15)>;
    			low-power-enable;
    		};
    	};
    };
    
    &i2c1 {
    	compatible = "nordic,nrf-twim";
    	status = "okay";
    	clock-frequency = <I2C_BITRATE_FAST>;
    	pinctrl-0 = <&i2c1_default>;
    	pinctrl-1 = <&i2c1_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    
    &spi4 {
    	status = "okay";
    	cs-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
    	pinctrl-0 = <&spi4_default>;
    	pinctrl-1 = <&spi4_sleep>;
    	pinctrl-names = "default", "sleep";
    
    	candevv: candev@0 {
    		status = "okay";
    		compatible = "microchip,mcp2515";
    		spi-max-frequency = <DT_FREQ_M(10)>;
    		int-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
    		reg = <0x0>;
    		osc-freq = <DT_FREQ_M(10)>;
    		bus-speed = <DT_FREQ_K(500)>;
    		sample-point = <875>;
    	
    		can-transceiver {
    			max-bitrate = <DT_FREQ_M(1)>;
    		};
    	};
    };
    
    / {
    	chosen {
    		nordic,nus-uart = &uart0;
    	};
    };
    

    Also, the SPI CAN mcp2515 device now fails to work. I can transmit information but can no longer receive, therefore I think it's also related to pins configuration.

  • Update:
    Starting from same sample, sdk v2.9.0, I added only my IIC and SPI (to CAN mcp2515) code/logic. I use for both IIC and SPI the default pins to communicate with my peripherals, to eliminate pin being used somehow by the network core or some config I am missing. The communication with any IIC device is impossible since I detect no clock signal on the pin (only data pin), while SPI pins all seems to carrying signal, just that the driver seems unable to communicate with the mac2515 and I get the following error

    00:00:00.401,794] <err> can_mcp2515: Timeout trying to set MCP2515 operation mode
    [00:00:00.401,824] <err> can_mcp2515: Failed to set the mode [-5]
    [00:00:00.401,824] <err> can: Error starting CAN controller [-5]

    Same overlay as before

    &spi4 {
    	status = "okay";
    	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
    	pinctrl-0 = <&spi4_default>;
    	pinctrl-1 = <&spi4_sleep>;
    	pinctrl-names = "default", "sleep";
    
    	candevv: candev@0 {
    		status = "okay";
    		compatible = "microchip,mcp2515";
    		spi-max-frequency = <DT_FREQ_M(10)>;
    		int-gpios = <&arduino_header 8 GPIO_ACTIVE_LOW>; /* D2 */
    		reg = <0x0>;
    		osc-freq = <DT_FREQ_M(10)>;
    		bitrate = <DT_FREQ_K(500)>;
    		sample-point = <875>;
    
    		can-transceiver {
    			max-bitrate = <DT_FREQ_M(1)>;
    		};
    	};
    };

    Is the CAN driver broken in the v2.9.0 version or more likely is there a configuration I am missing when having the BLE/ network core active.
    I am excluding the ideea that my code or the CAN peripheral (mcp2515) is broken or malfunctioning since when I upload my old application in v2.6.0 without bluetooth it works perfectly as intended.

  • Hi,

    Does CAN work when you are not using Bluetooth in v2.9.0?

    Can you test the CAN counter sample?

    Best regards,
    Marte

Reply Children
Related