nrf9160 at_client example build fails with overlay file

Hi,

I'm using a custom board with nrf52840 and nrf9160. I tried to build at_client sample (vscode) with nrf9160dk_nrf9160_ns.overlay -file added (tx and rx pins modified according to my board):

 

&uart0 {
	status = "okay";
	tx-pin = <5>;
	rx-pin = <6>;
	rts-pin = <0xFFFFFFFF>;
	cts-pin = <0xFFFFFFFF>;
};

Build fails with following error: "ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: '..\ncs\toolchains\v2.0.2\opt\bin\cmake.EXE' --build '..\ncs\v2.0.2\nrf\samples\nrf9160\at_client\build'

Sample builds just fine without the overlay file. What am I doing wrong here?

  • FAILED: zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj
    C:\Users\localadm\ncs\toolchains\v2.0.2\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF9160_XXAA -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -IC:/Users/localadm/ncs/v2.0.2/zephyr/include/zephyr -IC:/Users/localadm/ncs/v2.0.2/zephyr/include -Izephyr/include/generated -IC:/Users/localadm/ncs/v2.0.2/zephyr/soc/arm/nordic_nrf/nrf91 -IC:/Users/localadm/ncs/v2.0.2/zephyr/lib/libc/newlib/include -IC:/Users/localadm/ncs/v2.0.2/zephyr/soc/arm/nordic_nrf/common/. -IC:/Users/localadm/ncs/v2.0.2/zephyr/subsys/net/lib/sockets/. -IC:/Users/localadm/ncs/v2.0.2/nrf/include -IC:/Users/localadm/ncs/v2.0.2/nrf/include/tfm -Itfm/generated/interface/include -IC:/Users/localadm/ncs/v2.0.2/modules/hal/cmsis/CMSIS/Core/Include -IC:/Users/localadm/ncs/v2.0.2/modules/hal/nordic/nrfx -IC:/Users/localadm/ncs/v2.0.2/modules/hal/nordic/nrfx/drivers/include -IC:/Users/localadm/ncs/v2.0.2/modules/hal/nordic/nrfx/mdk -IC:/Users/localadm/ncs/v2.0.2/zephyr/modules/hal_nordic/nrfx/. -IC:/Users/localadm/ncs/v2.0.2/nrfxlib/nrf_modem/include -Itfm/install/interface/include -Imodules/nrfxlib/nrfxlib/nrf_security/src/include/generated -IC:/Users/localadm/ncs/v2.0.2/nrfxlib/nrf_security/include -IC:/Users/localadm/ncs/v2.0.2/nrfxlib/nrf_security/include/mbedtls -IC:/Users/localadm/ncs/v2.0.2/mbedtls/include -IC:/Users/localadm/ncs/v2.0.2/mbedtls/include/mbedtls -IC:/Users/localadm/ncs/v2.0.2/mbedtls/include/psa -IC:/Users/localadm/ncs/v2.0.2/mbedtls/library -IC:/Users/localadm/ncs/v2.0.2/nrfxlib/crypto/nrf_oberon/include/mbedtls -IC:/Users/localadm/ncs/v2.0.2/nrfxlib/crypto/nrf_oberon/include -Og -imacros C:/Users/localadm/ncs/v2.0.2/nrf/samples/nrf9160/at_client/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -imacros C:/Users/localadm/ncs/v2.0.2/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=C:/Users/localadm/ncs/v2.0.2/nrf/samples/nrf9160/at_client=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/Users/localadm/ncs/v2.0.2/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/Users/localadm/ncs/v2.0.2=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=c99 -MD -MT zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj -MF zephyr\drivers\serial\CMakeFiles\drivers__serial.dir\uart_nrfx_uarte.c.obj.d -o zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj -c C:/Users/localadm/ncs/v2.0.2/zephyr/drivers/serial/uart_nrfx_uarte.c
    In file included from C:\Users\localadm\ncs\v2.0.2\zephyr\include\zephyr\toolchain.h:50,
    from C:\Users\localadm\ncs\v2.0.2\zephyr\include\zephyr\init.h:10,
    from C:\Users\localadm\ncs\v2.0.2\zephyr\include\zephyr\device.h:29,
    from C:\Users\localadm\ncs\v2.0.2\zephyr\include\zephyr\drivers\uart.h:26,
    from C:\Users\localadm\ncs\v2.0.2\zephyr\drivers\serial\uart_nrfx_uarte.c:11:
    C:\Users\localadm\ncs\v2.0.2\zephyr\include\zephyr\toolchain\gcc.h:77:36: error: static assertion failed: "/soc/peripheral@40000000/uart@8000 has legacy *-pin properties defined although PINCTRL is enabled"

  • Hi,

    If you are using a custom board I would recommend creating a custom board instead of using overlays. If you are using VS Code you can follow this instruction: Adding a custom board.

    Regarding the error you are getting, this is because you have not added pin control properties to uart0. This was introduced in nRF Connect SDK v2, and you can find a guide on how to use it here: Pin Control. The main take away is that you need to use pinctrl instead of the tx-pin, rx-pin, rts-pin and cts-pin in uart0:

    &uart0 {
    	status = "okay";
    	current-speed = <115200>;
    	pinctrl-0 = <&uart0_default>;
    	pinctrl-1 = <&uart0_sleep>;
    	pinctrl-names = "default", "sleep";
    };

    And then you need to add the pinctrl node:

    &pinctrl {
    	uart0_default: uart0_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 29)>,
    				<NRF_PSEL(UART_RTS, 0, 27)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 28)>,
    				<NRF_PSEL(UART_CTS, 0, 26)>;
    			bias-pull-up;
    		};
    	};
    
    	uart0_sleep: uart0_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 29)>,
    				<NRF_PSEL(UART_RX, 0, 28)>,
    				<NRF_PSEL(UART_RTS, 0, 27)>,
    				<NRF_PSEL(UART_CTS, 0, 26)>;
    			low-power-enable;
    		};
    	};
    };

    This is taken directly from nrf9160dk_nrf9160_common.dts and nrf9160dk_nrf9160_common-pinctrl.dtsi, so you will have to change the pin numbers to what you are using.

    Best regards,

    Marte

Related