creating a custom board for nRf52840

Hi there,

         I've been developing nicely with the nrf52840SDK board for a while now.

I am trying to create a custom board now for our development PCB using nRf52840 micro.

I created a new board with nrf52840 as the SoC and then created an overlay file with all my peripherals.

Seems to build ok, but when I try to get a pointer to a device node, GPIO, SPI etc I get errors such as...

FAILED: zephyr/drivers/spi/CMakeFiles/drivers__spi.dir/spi_nrfx_spim.c.obj 

c:\Temp\Wearable\Code\SB_wearableFW\build\zephyr\include\generated\devicetree_unfixed.h:11437:38: errorC:\ncs\v2.1.0\zephyr\include\zephyr\toolchain\gcc.h:77:36: error: static assertion failed: "/soc/spi@40004000 defined without required pin configuration"

'DT_N_S_soc_S_spi_40004000_P_sck_pin' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_spi_40004000_P_status'?

C:\ncs\v2.1.0\zephyr\include\zephyr\toolchain\gcc.h:77:36: error: static assertion failed: "/soc/spi@40023000 defined without required pin configuration"

The devices seem to be picked up as shown here..

and they are included in the compiled device tree output file... 

/dts-v1/;

/ {
        #address-cells = <1>;
        #size-cells = <1>;
        model = "SB_Wearable";
        compatible = "cubik-innovation-,sb-wearable01";
        chosen {
                zephyr,entropy = &cryptocell;
                zephyr,flash-controller = &flash_controller;
                zephyr,sram = &sram0;
                zephyr,flash = &flash0;
                zephyr,code-partition = &slot0_partition;
        };

        aliases {
                key1 = &button0;
                key2 = &button1;
                backlightpwm = &pwm0;
                hapticpwm = &pwm1;
                buzzerpwm = &pwm2;
        };

        soc {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "nordic,nRF52840-QIAA",
                             "nordic,nRF52840",
                             "nordic,nRF52",
                             "simple-bus";
                interrupt-parent = <&nvic>;
                ranges;
                nvic: interrupt-controller@e000e100 {
                        #address-cells = <1>;
                        compatible = "arm,v7m-nvic";
                        reg = <0xe000e100 0xc00>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
                        arm,num-irq-priority-bits = <3>;
                };

                systick: timer@e000e010 {
                        compatible = "arm,armv7m-systick";
                        reg = <0xe000e010 0x10>;
                        status = "disabled";
                };

                ficr: ficr@10000000 {
                        compatible = "nordic,nrf-ficr";
                        reg = <0x10000000 0x1000>;
                        status = "okay";
                };

                uicr: uicr@10001000 {
                        compatible = "nordic,nrf-uicr";
                        reg = <0x10001000 0x1000>;
                        status = "okay";
                };

                sram0: memory@20000000 {
                        compatible = "mmio-sram";
                        reg = <0x20000000 DT_SIZE_K(256)>;
                };

                clock: clock@40000000 {
                        compatible = "nordic,nrf-clock";
                        reg = <0x40000000 0x1000>;
                        interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                power: power@40000000 {
                        compatible = "nordic,nrf-power";
                        reg = <0x40000000 0x1000>;
                        interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                radio: radio@40001000 {
                        compatible = "nordic,nrf-radio";
                        reg = <0x40001000 0x1000>;
                        interrupts = <1 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                        ieee802154-supported;
                        ble-2mbps-supported;
                        ble-coded-phy-supported;
                        tx-high-power-supported;
                };

                uart0: uart@40002000 {
                        compatible = "nordic,nrf-uarte";
                        reg = <0x40002000 0x1000>;
                        interrupts = <2 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "disabled";
                };

                i2c0: i2c@40003000 {
                        compatible = "nordic,nrf-twim";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x40003000 0x1000>;
                        clock-frequency = <I2C_BITRATE_STANDARD>;
                        interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                        pinctrl-0 = <&i2c0_default>;
                        pinctrl-1 = <&i2c0_sleep>;
                        batt_I2C: batt_chg@3c {
                                compatible = "i2c-device";
                                reg = <0x3c>;
                                label = "Battery charger I2C";
                        };

                };

                spi0: spi@40003000 {
                        compatible = "nordic,nrf-spim";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x40003000 0x1000>;
                        interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>;
                        max-frequency = <DT_FREQ_M(8)>;
                        status = "disabled";
                };

                i2c1: i2c@40004000 {
                        compatible = "nordic,nrf-twim";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x40004000 0x1000>;
                        clock-frequency = <I2C_BITRATE_STANDARD>;
                        interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "disabled";
                };

                spi1: my_spi_master: spi@40004000 {
                        compatible = "nordic,nrf-spim";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x40004000 0x1000>;
                        interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>;
                        max-frequency = <DT_FREQ_M(8)>;
                        status = "okay";
                        pinctrl-0 = <&spi1_default>;
                        pinctrl-1 = <&spi1_sleep>;
                        cs-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
                        display_spi: display@0 {
                                reg = <0>;
                        };

                };

                nfct: nfct@40005000 {
                        compatible = "nordic,nrf-nfct";
                        reg = <0x40005000 0x1000>;
                        interrupts = <5 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "disabled";
                };

                gpiote: gpiote@40006000 {
                        compatible = "nordic,nrf-gpiote";
                        reg = <0x40006000 0x1000>;
                        interrupts = <6 5>;
                        status = "disabled";
                };

                adc: adc@40007000 {
                        compatible = "nordic,nrf-saadc";
                        reg = <0x40007000 0x1000>;
                        interrupts = <7 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "disabled";
                        #io-channel-cells = <1>;
                };

                timer0: timer@40008000 {
                        compatible = "nordic,nrf-timer";
                        status = "okay";
                        reg = <0x40008000 0x1000>;
                        cc-num = <4>;
                        interrupts = <8 NRF_DEFAULT_IRQ_PRIORITY>;
                        prescaler = <0>;
                };

                timer1: timer@40009000 {
                        compatible = "nordic,nrf-timer";
                        status = "okay";
                        reg = <0x40009000 0x1000>;
                        cc-num = <4>;
                        interrupts = <9 NRF_DEFAULT_IRQ_PRIORITY>;
                        prescaler = <0>;
                };

                timer2: timer@4000a000 {
                        compatible = "nordic,nrf-timer";
                        status = "okay";
                        reg = <0x4000a000 0x1000>;
                        cc-num = <4>;
                        interrupts = <10 NRF_DEFAULT_IRQ_PRIORITY>;
                        prescaler = <0>;
                };

                rtc0: rtc@4000b000 {
                        compatible = "nordic,nrf-rtc";
                        reg = <0x4000b000 0x1000>;
                        cc-num = <3>;
                        interrupts = <11 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                        clock-frequency = <32768>;
                        prescaler = <1>;
                };

                temp: temp@4000c000 {
                        compatible = "nordic,nrf-temp";
                        reg = <0x4000c000 0x1000>;
                        interrupts = <12 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                rng: random@4000d000 {
                        compatible = "nordic,nrf-rng";
                        reg = <0x4000d000 0x1000>;
                        interrupts = <13 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                ecb: ecb@4000e000 {
                        compatible = "nordic,nrf-ecb";
                        reg = <0x4000e000 0x1000>;
                        interrupts = <14 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                ccm: ccm@4000f000 {
                        compatible = "nordic,nrf-ccm";
                        reg = <0x4000f000 0x1000>;
                        interrupts = <15 NRF_DEFAULT_IRQ_PRIORITY>;
                        length-field-length-8-bits;
                        status = "okay";
                };

                wdt: wdt0: watchdog@40010000 {
                        compatible = "nordic,nrf-wdt";
                        reg = <0x40010000 0x1000>;
                        interrupts = <16 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                rtc1: rtc@40011000 {
                        compatible = "nordic,nrf-rtc";
                        reg = <0x40011000 0x1000>;
                        cc-num = <4>;
                        interrupts = <17 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                        clock-frequency = <32768>;
                        prescaler = <1>;
                };

                qdec: qdec0: qdec@40012000 {
                        compatible = "nordic,nrf-qdec";
                        reg = <0x40012000 0x1000>;
                        interrupts = <18 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "disabled";
                };

                comp: comparator@40013000 {
                        compatible = "nordic,nrf-comp";
                        reg = <0x40013000 0x1000>;
                        interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "disabled";
                        #io-channel-cells = <1>;
                };

                egu0: swi0: egu@40014000 {
                        compatible = "nordic,nrf-egu", "nordic,nrf-swi";
                        reg = <0x40014000 0x1000>;
                        interrupts = <20 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                egu1: swi1: egu@40015000 {
                        compatible = "nordic,nrf-egu", "nordic,nrf-swi";
                        reg = <0x40015000 0x1000>;
                        interrupts = <21 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                egu2: swi2: egu@40016000 {
                        compatible = "nordic,nrf-egu", "nordic,nrf-swi";
                        reg = <0x40016000 0x1000>;
                        interrupts = <22 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                egu3: swi3: egu@40017000 {
                        compatible = "nordic,nrf-egu", "nordic,nrf-swi";
                        reg = <0x40017000 0x1000>;
                        interrupts = <23 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                egu4: swi4: egu@40018000 {
                        compatible = "nordic,nrf-egu", "nordic,nrf-swi";
                        reg = <0x40018000 0x1000>;
                        interrupts = <24 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                egu5: swi5: egu@40019000 {
                        compatible = "nordic,nrf-egu", "nordic,nrf-swi";
                        reg = <0x40019000 0x1000>;
                        interrupts = <25 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                };

                timer3: timer@4001a000 {
                        compatible = "nordic,nrf-timer";
                        status = "okay";
                        reg = <0x4001a000 0x1000>;
                        cc-num = <6>;
                        interrupts = <26 NRF_DEFAULT_IRQ_PRIORITY>;
                        prescaler = <0>;
                };

                timer4: timer@4001b000 {
                        compatible = "nordic,nrf-timer";
                        status = "okay";
                        reg = <0x4001b000 0x1000>;
                        cc-num = <6>;
                        interrupts = <27 NRF_DEFAULT_IRQ_PRIORITY>;
                        prescaler = <0>;
                };

                pwm0: pwm@4001c000 {
                        compatible = "nordic,nrf-pwm";
                        reg = <0x4001c000 0x1000>;
                        interrupts = <28 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                        #pwm-cells = <3>;
                        pinctrl-0 = <&pwm0_default>;
                        pinctrl-1 = <&pwm0_sleep>;
                        pinctrl-names = "default", "sleep";
                };

                pdm0: dmic_dev: pdm@4001d000 {
                        compatible = "nordic,nrf-pdm";
                        reg = <0x4001d000 0x1000>;
                        interrupts = <29 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                        pinctrl-0 = <&pdm0_default_alt>;
                        pinctrl-names = "default";
                        clock-source = "PCLK32M_HFXO";
                };

                acl: acl@4001e000 {
                        compatible = "nordic,nrf-acl";
                        reg = <0x4001e000 0x1000>;
                        status = "okay";
                };

                flash_controller: flash-controller@4001e000 {
                        compatible = "nordic,nrf52-flash-controller";
                        reg = <0x4001e000 0x1000>;
                        partial-erase;
                        #address-cells = <1>;
                        #size-cells = <1>;
                        flash0: flash@0 {
                                compatible = "soc-nv-flash";
                                erase-block-size = <4096>;
                                write-block-size = <4>;
                                reg = <0x00000000 DT_SIZE_K(1024)>;
                                partitions {
                                        compatible = "fixed-partitions";
                                        #address-cells = <1>;
                                        #size-cells = <1>;
                                        boot_partition: partition@0 {
                                                label = "mcuboot";
                                                reg = <0x0 0xc000>;
                                        };

                                        slot0_partition: partition@c000 {
                                                label = "image-0";
                                                reg = <0xc000 0x72000>;
                                        };

                                        slot1_partition: partition@7e000 {
                                                label = "image-1";
                                                reg = <0x7e000 0x72000>;
                                        };

                                        scratch_partition: partition@f0000 {
                                                label = "image-scratch";
                                                reg = <0xf0000 0xa000>;
                                        };

                                        storage_partition: partition@fa000 {
                                                label = "storage";
                                                reg = <0xfa000 0x6000>;
                                        };

                                };

                        };

                };

                ppi: ppi@4001f000 {
                        compatible = "nordic,nrf-ppi";
                        reg = <0x4001f000 0x1000>;
                        status = "okay";
                };

                mwu: mwu@40020000 {
                        compatible = "nordic,nrf-mwu";
                        reg = <0x40020000 0x1000>;
                        status = "okay";
                };

                pwm1: pwm@40021000 {
                        compatible = "nordic,nrf-pwm";
                        reg = <0x40021000 0x1000>;
                        interrupts = <33 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                        #pwm-cells = <3>;
                        pinctrl-0 = <&pwm1_default>;
                        pinctrl-1 = <&pwm1_sleep>;
                        pinctrl-names = "default", "sleep";
                };

                pwm2: pwm@40022000 {
                        compatible = "nordic,nrf-pwm";
                        reg = <0x40022000 0x1000>;
                        interrupts = <34 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                        #pwm-cells = <3>;
                        pinctrl-0 = <&pwm2_default>;
                        pinctrl-1 = <&pwm2_sleep>;
                        pinctrl-names = "default", "sleep";
                };

                spi2: my_spi_master_2: spi@40023000 {
                        compatible = "nordic,nrf-spim";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x40023000 0x1000>;
                        interrupts = <35 NRF_DEFAULT_IRQ_PRIORITY>;
                        max-frequency = <DT_FREQ_M(8)>;
                        status = "okay";
                        pinctrl-0 = <&spi2_default>;
                        pinctrl-1 = <&spi2_sleep>;
                        cs-gpios = <&gpio0 29 GPIO_ACTIVE_LOW>,
                                   <&gpio0 20 GPIO_ACTIVE_LOW>;
                        acc_gyro_spi: acc_gyro@0 {
                                reg = <0>;
                        };

                        flash_spi: flash_ic@1 {
                                reg = <1>;
                        };

                };

                rtc2: rtc@40024000 {
                        compatible = "nordic,nrf-rtc";
                        reg = <0x40024000 0x1000>;
                        cc-num = <4>;
                        interrupts = <36 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "okay";
                        clock-frequency = <32768>;
                        prescaler = <1>;
                };

                i2s0: i2s@40025000 {
                        compatible = "nordic,nrf-i2s";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x40025000 0x1000>;
                        interrupts = <37 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "disabled";
                };

                usbd: usbd@40027000 {
                        compatible = "nordic,nrf-usbd";
                        reg = <0x40027000 0x1000>;
                        interrupts = <39 NRF_DEFAULT_IRQ_PRIORITY>;
                        num-bidir-endpoints = <1>;
                        num-in-endpoints = <7>;
                        num-out-endpoints = <7>;
                        num-isoin-endpoints = <1>;
                        num-isoout-endpoints = <1>;
                        status = "disabled";
                };

                uart1: uart@40028000 {
                        compatible = "nordic,nrf-uarte";
                        reg = <0x40028000 0x1000>;
                        interrupts = <40 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "disabled";
                };

                qspi: qspi@40029000 {
                        compatible = "nordic,nrf-qspi";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x40029000 0x1000>, <0x12000000 0x8000000>;
                        reg-names = "qspi", "qspi_mm";
                        interrupts = <41 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "disabled";
                };

                pwm3: pwm@4002d000 {
                        compatible = "nordic,nrf-pwm";
                        reg = <0x4002d000 0x1000>;
                        interrupts = <45 NRF_DEFAULT_IRQ_PRIORITY>;
                        status = "disabled";
                        #pwm-cells = <3>;
                };

                spi3: spi@4002f000 {
                        compatible = "nordic,nrf-spim";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x4002f000 0x1000>;
                        interrupts = <47 NRF_DEFAULT_IRQ_PRIORITY>;
                        max-frequency = <DT_FREQ_M(32)>;
                        rx-delay-supported;
                        rx-delay = <2>;
                        status = "disabled";
                };

                gpio0: gpio@50000000 {
                        compatible = "nordic,nrf-gpio";
                        gpio-controller;
                        reg = <0x50000000 0x200 0x50000500 0x300>;
                        #gpio-cells = <2>;
                        status = "okay";
                        port = <0>;
                };

                gpio1: gpio@50000300 {
                        compatible = "nordic,nrf-gpio";
                        gpio-controller;
                        reg = <0x50000300 0x200 0x50000800 0x300>;
                        #gpio-cells = <2>;
                        ngpios = <16>;
                        status = "okay";
                        port = <1>;
                };

                cryptocell: crypto@5002a000 {
                        compatible = "nordic,nrf-cc310";
                        reg = <0x5002A000 0x1000>;
                        status = "okay";
                        #address-cells = <1>;
                        #size-cells = <1>;
                        cryptocell310: crypto@5002b000 {
                                compatible = "arm,cryptocell-310";
                                reg = <0x5002B000 0x1000>;
                                interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>;
                        };

                };

        };

        pinctrl: pin-controller {
                compatible = "nordic,nrf-pinctrl";
                spi1_default: spi1_default {
                        group1 {
                                psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
                                        <NRF_PSEL(SPIM_MOSI, 0, 14)>,
                                        <NRF_PSEL(SPIM_MISO, 0, 16)>;
                        };

                };

                spi1_sleep: spi1_sleep {
                        group1 {
                                psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
                                        <NRF_PSEL(SPIM_MOSI, 0, 14)>,
                                        <NRF_PSEL(SPIM_MISO, 0, 16)>;
                                low-power-enable;
                        };

                };

                spi2_default: spi2_default {
                        group1 {
                                psels = <NRF_PSEL(SPIS_SCK, 0, 6)>,
                                        <NRF_PSEL(SPIS_MOSI, 0, 8)>,
                                        <NRF_PSEL(SPIS_MISO, 0, 9)>;
                        };

                };

                spi2_sleep: spi2_sleep {
                        group1 {
                                psels = <NRF_PSEL(SPIS_SCK, 0, 6)>,
                                        <NRF_PSEL(SPIS_MOSI, 0, 8)>,
                                        <NRF_PSEL(SPIS_MISO, 0, 9)>;
                                low-power-enable;
                        };

                };

                i2c0_default: i2c0_default {
                        group1 {
                                psels = <NRF_PSEL(TWIM_SDA, 0, 4)>,
                                        <NRF_PSEL(TWIM_SCL, 0, 26)>;
                        };

                };

                i2c0_sleep: i2c0_sleep {
                        group1 {
                                psels = <NRF_PSEL(TWIM_SDA, 0, 4)>,
                                        <NRF_PSEL(TWIM_SCL, 0, 26)>;
                                low-power-enable;
                        };

                };

                pwm0_default: pwm0_default {
                        group1 {
                                psels = <NRF_PSEL(PWM_OUT0, 1, 0)>;
                                nordic,invert;
                        };

                };

                pwm0_sleep: pwm0_sleep {
                        group1 {
                                psels = <NRF_PSEL(PWM_OUT0, 1, 0)>;
                                low-power-enable;
                        };

                };

                pwm1_default: pwm1_default {
                        group1 {
                                psels = <NRF_PSEL(PWM_OUT1, 0, 24)>;
                                nordic,invert;
                        };

                };

                pwm1_sleep: pwm1_sleep {
                        group1 {
                                psels = <NRF_PSEL(PWM_OUT1, 0, 24)>;
                                low-power-enable;
                        };

                };

                pwm2_default: pwm2_default {
                        group1 {
                                psels = <NRF_PSEL(PWM_OUT2, 0, 25)>;
                                nordic,invert;
                        };

                };

                pwm2_sleep: pwm2_sleep {
                        group1 {
                                psels = <NRF_PSEL(PWM_OUT2, 0, 25)>;
                                low-power-enable;
                        };

                };

                pdm0_default_alt: pdm0_default_alt {
                        group1 {
                                psels = <NRF_PSEL(PDM_CLK, 0, 12)>,
                                        <NRF_PSEL(PDM_DIN, 0, 11)>;
                        };

                };

        };

        rng_hci: entropy_bt_hci {
                compatible = "zephyr,bt-hci-entropy";
                status = "okay";
        };

        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                cpu@0 {
                        device_type = "cpu";
                        compatible = "arm,cortex-m4f";
                        reg = <0>;
                        #address-cells = <1>;
                        #size-cells = <1>;
                        itm: itm@e0000000 {
                                compatible = "arm,armv7m-itm";
                                reg = <0xe0000000 0x1000>;
                                swo-ref-frequency = <32000000>;
                        };

                };

        };

        sw_pwm: sw-pwm {
                compatible = "nordic,nrf-sw-pwm";
                status = "disabled";
                generator = <&timer2>;
                clock-prescaler = <0>;
                #pwm-cells = <3>;
        };

        buttons {
                compatible = "gpio-keys";
                button0: button_0 {
                        gpios = <&gpio1 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                        label = "Wearable key 1";
                };

                button1: button_1 {
                        gpios = <&gpio1 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                        label = "Wearable key 2";
                };

        };

        acc_ints {
                compatible = "gpio-keys";
                acc_int1: acc_int_1 {
                        gpios = <&gpio1 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                        label = "ACC_GYRO INT1 pin";
                };

                acc_int2: acc_int_2 {
                        gpios = <&gpio1 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                        label = "ACC_GYRO INT2 pin";
                };

        };

        batt_chg_int {
                compatible = "gpio-keys";
                batt_int: batt_int {
                        gpios = <&gpio0 31 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
                        label = "Battery charger interrupt";
                };

        };

        outputs {
                compatible = "gpio-leds";
                ledreset: ledreset {
                        gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
                        label = "OLED reset pin ctl";
                };

                leddc: leddc {
                        gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
                        label = "LED Display data/command select";
                };

                poweren: poweren {
                        gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
                        label = "Logic power supply assert pin1";
                };

                flashichold: flashichold {
                        gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
                        label = "Flash IC hold pin";
                };

                flashwp: flashwp {
                        gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
                        label = "Flash Write protect";
                };

                hapticen: hapticen {
                        gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
                        label = "Haptic motor enable line";
                };

        };

};

in main.c I am trying to get pointers to device nodes..

#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>
#include <drivers/gpio.h>
#define DISPLAY_NODE DT_ALIAS(flashrst)
#define MYSPI_NODE	DT_NODELABEL(spi1)
struct gpio_dt_spec display_reset = GPIO_DT_SPEC_GET(DISPLAY_NODE, gpios);
void main(void)
{
	const struct device *spiDev;  /* SPI device pointer*/
	/* Get the SPI device handle*/
	spiDev = DEVICE_DT_GET(MYSPI_NODE);
	if(!device_is_ready(spiDev))
	{
		return;
	}
	//else
	//{
	///	printk("Device is ready %s\n");
	//}
	//printk("Hello World! %s\n", CONFIG_BOARD);
	/* check devices are ready: Could make this a function?*/
	
}

but getting build errors.

When I look at the .dts file

it seems to have none of the nodes defined and gives me warnings for compatible property like so..

the file is below and has nothing after &flash0 node

I'm sure it should!!

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>

/ {
	model = "SB_Wearable";
	compatible = "cubik-innovation-,sb-wearable01";

	chosen {
		zephyr,sram = &sram0;
		zephyr,flash = &flash0;
		zephyr,code-partition = &slot0_partition;
	};
};

&flash0 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x0 0xc000>;
		};
		slot0_partition: partition@c000 {
			label = "image-0";
			reg = <0xc000 0x72000>;
		};
		slot1_partition: partition@7e000 {
			label = "image-1";
			reg = <0x7e000 0x72000>;
		};
		scratch_partition: partition@f0000 {
			label = "image-scratch";
			reg = <0xf0000 0xa000>;
		};
		storage_partition: partition@fa000 {
			label = "storage";
			reg = <0xfa000 0x6000>;
		};
	};
};

What am I doing wrong please?

Many thanks

Duncan

Parents
  • Hello

    What SDK version are you using?

    From your error messages it looks like the compiler expects to find a sck_pin in your SPI node but doesn't.

    This is supposed to be set in pinctrl, and it looks like you're doing it, but if you're using an old SDK version that could explain why it doesn't work.

    the file is below and has nothing after &flash0 node

    This file is only part of what generates the final devicetree, what matters is that the final devicetree built in build/zephyr/zephyr.dts is correct.

    Best regards,

    Einar

  • Hi Elinar, thanks for your reply.

    I'm using SDK2.1.0.

    If I do a fresh build with the nrf52840dk and add some overlay for gpio and spi it builds ok. 

    What I'm trying to do is create a custom board for our PCB with the nrf52840 as soc and that's where I seem to run into issues.

    Cheers

    Duncan

  • Hi Elinar, I have been trying to resolve this issue over the weekend but with little progress!
    Searching through similar support cases I found this recent one which seems very similar to my issue

    CASE ID:301905

    Can I just clarify that I am following the correct steps to define a custom board and then add peripheral drivers via dts overlay?

    1. Click "Create a new board"

    2. name the board, eg "My new board"

    3. Give it an ID, eg "My_new_boad"

    4. Vendor name: eg "Duncan"

    5: Board root folder: eg "C:\my_projects

    step 5 is the only one I don't get, the hint says "West will search through the boards folder of each board root to resolve board Id's. This option determines which board root to add this board to. New board roots will be added to West build commands"

    should the path to the Board root folder be in "my_projects" or is it in the boards folder in zephyr root? I really don't understand this part sorry!

    For my custom board the Board root folder I set as "C:/temp/wearable" which is the folder my code is in.

    Hopefully this information will help you to help me!

    Cheers

    Duncan

  • Hi

    DunKCubik said:
    should the path to the Board root folder be in "my_projects" or is it in the boards folder in zephyr root?

    I would interpret that to mean it should point to the board directory, wherever that is.

    Have a look at Zephyr's board porting guide if you haven't already, it goes through things pretty in depth:

    https://docs.zephyrproject.org/latest/hardware/porting/board_porting.html

    DunKCubik said:
    this is from the compiled device tree output file (is that what you wanted?)

    Yes, I wanted to compare the dt that compiles to the one that doesn't.

    Looks like the only property really missing from your dt is pinctrl-names, and for some reason you have numbers instead of many of the placeholder names.

    You might lack some include, make sure you have all the mandatory files from the Zephyr board porting guide.

    -Einar

  • Hi Elinar, I wasn't aware of the board porting guide before so thank you for pointing it out to me. I have looked at the guide now and also a webinar that describes how to port to a custom board

    Getting started with custom development in nRF Connect SDK - Nordic Semiconductor

    So my question is this: If I have to manually do the board porting as described in the Zephyr guide and the above webinar then what is the function of the "create new board" option in the VScode nrf extension? My understanding was that this feature would automate the custom board setup, but it seems that it still requires some manual operations.

    Cheers

    Duncan 

  • Yes, the "create new board" option is supposed to automate this process, but if something doesn't work then this guide could hopefully give you an idea of where to look for errors and what to debug.

  • Hi Elinar,

             just an update on my issue.

    Thanks for pointing me towards the pinctrl definitions as this seems to be the problem.

    If I manually assign sck and mosi pins in the dts file spi1 node as such..

    sck-pin = <13>;
    mosi-pin = <14>;
    then it builds correctly(It warns me that they are depreciated though, is that a problem?)
    If I use..
        pinctrl-0 = <&spi1_default>;
    it fails.
    I notice in the nrf52840dk .dts file that there is a node called..
     pinctrl: pin-controller {..
    There is no corresponding definition in my custom board .dts so Imagine this is the problem?
    I have defined the following in my overlay..
    &pinctrl {
        spi1_default: spi1_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
                        <NRF_PSEL(SPIM_MOSI, 0, 14)>,
                        //MISO not required for display but define anyway
                        <NRF_PSEL(SPIM_MISO, 0, 16)>;
            };
        };
    };
    Is there something else I should be doing?
    Cheers
    Duncan
     
Reply
  • Hi Elinar,

             just an update on my issue.

    Thanks for pointing me towards the pinctrl definitions as this seems to be the problem.

    If I manually assign sck and mosi pins in the dts file spi1 node as such..

    sck-pin = <13>;
    mosi-pin = <14>;
    then it builds correctly(It warns me that they are depreciated though, is that a problem?)
    If I use..
        pinctrl-0 = <&spi1_default>;
    it fails.
    I notice in the nrf52840dk .dts file that there is a node called..
     pinctrl: pin-controller {..
    There is no corresponding definition in my custom board .dts so Imagine this is the problem?
    I have defined the following in my overlay..
    &pinctrl {
        spi1_default: spi1_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
                        <NRF_PSEL(SPIM_MOSI, 0, 14)>,
                        //MISO not required for display but define anyway
                        <NRF_PSEL(SPIM_MISO, 0, 16)>;
            };
        };
    };
    Is there something else I should be doing?
    Cheers
    Duncan
     
Children
  • DunKCubik said:

    If I manually assign sck and mosi pins in the dts file spi1 node as such..

    sck-pin = <13>;
    mosi-pin = <14>;
    then it builds correctly(It warns me that they are depreciated though, is that a problem?)

    Well it is deprecated for a reason, and will probably not be supported in future updates, so try to use the newer pinctrl system instead if you're able.

    DunKCubik said:
    I notice in the nrf52840dk .dts file that there is a node called..
     pinctrl: pin-controller {..
    There is no corresponding definition in my custom board .dts so Imagine this is the problem?

    Yes, if your dts didn't have a pinctrl node than that was definitely the problem.

    Does it build when you added it to your overlay?

    -Einar

  • Hi Elinar,

           I did have a pinctl node originally but it never worked so that's why I tried manually assigning the pins. I tried adding pinctl node back in but get the same build error as previously that mentions the "DT_N_S_soc_S_spi_400004000_P_sck_pim" undeclared in devicetree_generated.h

    My overlay code is below with the pinctrl node. I don't understand what I'm doing wrong as the dts file builds fine.

    /{
    aliases {
        led0 = &led0;
    };
        
        leds {
            compatible = "gpio-leds";
            led0: led_0 {
                    gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
                    label = "Green LED 0";
                    
            };
        };  
    };
    
    //Display is on spi1
    my_spi_master: &spi1 {
    	compatible = "nordic,nrf-spim";
    	status = "okay";
    	pinctrl-0 = <&spi1_default>;
        //sck-pin = <13>;
        //mosi-pin = <14>;
        cs-gpios = < &gpio0 15 GPIO_ACTIVE_LOW>;     //CS for 1st device >;
    
        display_spi: display@0 {
    		
    		reg = <0>;
    	};
    };
    &gpio0 {
    	status = "okay";
    };
    
    &pinctrl {
        spi1_default: spi1_default {
            group1 {
                    psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
                            <NRF_PSEL(SPIM_MOSI, 0, 14)>;
    
            };
    
        };
        
    };

    At least I've narrowed it down to pinctrl issues!

    main test code, modified blinky sample

    Thanks again

    Duncan

    Cheers

    Duncan

  • Sorry Elinar I forgot to include the main file. Here it is..

    #include <zephyr/kernel.h>
    #include <zephyr/drivers/gpio.h>
    #include <zephyr/devicetree.h> 
    #include <zephyr/drivers/spi.h>
    /* 1000 msec = 1 sec */
    #define SLEEP_TIME_MS   1000
    
    /* The devicetree node identifier for the "led0" alias. */
    #define LED0_NODE DT_ALIAS(led0)
    #define MYSPI_NODE	DT_NODELABEL(my_spi_master)
    /*
     * A build error on this line means your board is unsupported.
     * See the sample documentation for information on how to fix this.
     */
    static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
    static const struct device *spiDev;  /* SPI device pointer*/
    void main(void)
    {
    	int ret;
    
    	if (!device_is_ready(led.port)) {
    		return;
    	}
    
    	ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
    	if (ret < 0) {
    		return;
    	}
    	/* Get the SPI device handle*/
    	spiDev = DEVICE_DT_GET(MYSPI_NODE);
    	if(!device_is_ready(spiDev))
    	{
    		return;
    	}
    	
    	while (1) {
    		ret = gpio_pin_toggle_dt(&led);
    		if (ret < 0) {
    			return;
    		}
    		k_msleep(SLEEP_TIME_MS);
    	}
    }
    

    Had a look at the nordic pinctrl documentation also and still can't see what's wrong as I'm doing what it says adding the pinctrl to the overlay file.

    Really stuck on this now so any further help would be greatly appreciated,

    Cheers

    Duncan

  • I would recommend you compare your compiled devicetree (build/zephyr/zephyr.dts) to the working one you get when you compile for the DK, and make sure the nodes contain the same parameters.

    Specifically I would try to include this whole bulk in the spi node:

    pinctrl-0 = <&spi1_default>;
    pinctrl-1 = <&spi1_sleep>;
    pinctrl-names = "default", "sleep";

    And I would make sure the pinctrl node looks exactly the same as in the working one.

    -Einar

  • HI Elinar,

         I have discovered what the issue is and it's a strange one I feel!

    This is the kconfig output from the dk build that works ok.

    ..and this is from my custom board..

    As you can see they both say pinctrl is enabled so I assumed it was by default, but it isn't.

    So I added CONFIG_PINCTRL to prj.conf and it built correctly.

    Also I can add it into my defconfig custom board file and it works.

    Maybe I have misunderstood but I wonder why it's reported as enabled in Gioconfig even though it is actually disabled by default?

    Anyway, it works now and as usual was something simple!

    Thanks again for your help and pointers, got there in the end.

    Cheers

    Duncan

Related