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

  • I think it's something I'm doing wrong with the overlays. For example if I add the following to my overlay file..

    my_spi_master: &spi1 {
    	compatible = "nordic,nrf-spim";
    	status = "okay";
    	pinctrl-0 = <&spi1_default>;
    	pinctrl-1 = <&spi1_sleep>;
    	cs-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;     //CS for 1st device
    	display_spi: display@0 {
    		
    		reg = <0>;
    	};
    };

    I get an error trying to get a device pointer to the node with the label "display_spi"
    #define MYSPI_NODE  DT_NODELABEL(display_spi)
     
    If I use..
    #define MYSPI_NODE  DT_NODELABEL(spi1)
    It builds ok.
    What am I doing wrong with the spi overlay?
    Cheers
    Duncan
  • This overlay with the display subnode, does it work when you try to access it on the DK, or does it always fail?

  • Hi Elinar,

           no it doesn't! I realised that I should be using the label my_spi_master, as display_spi is for the chip select!! So that wasn't helping!

    But even using the correct node label with my custom board I get an error after I check for device_is_ready.

    #include <zephyr/zephyr.h>
    #include <drivers/gpio.h>
    #include <zephyr/drivers/spi.h>
    
    #define MYSPI_NODE	DT_NODELABEL(my_spi_master)
    
    void main(void)
    {
    	const struct device *dispDev; /* SPI device pointer*/
    	printk("Hello World! %s\n", CONFIG_BOARD);
    	
    	/* Get the SPI device handle*/
    	dispDev = DEVICE_DT_GET(MYSPI_NODE);
    	if(!device_is_ready(dispDev))
    	{
    		return;
    	}
    }

    This gives me the error..

    C:\ncs\v2.1.0\zephyr\include\zephyr\device.h:831: undefined reference to `__device_dts_ord_91'

    Commenting out the device_is_ready line builds ok.

    But if I use the nrf52840dk board rather than my custom board there is no problem getting the device pointer to the spi.

    I wonder if it is a problem with my custom board?

Reply
  • Hi Elinar,

           no it doesn't! I realised that I should be using the label my_spi_master, as display_spi is for the chip select!! So that wasn't helping!

    But even using the correct node label with my custom board I get an error after I check for device_is_ready.

    #include <zephyr/zephyr.h>
    #include <drivers/gpio.h>
    #include <zephyr/drivers/spi.h>
    
    #define MYSPI_NODE	DT_NODELABEL(my_spi_master)
    
    void main(void)
    {
    	const struct device *dispDev; /* SPI device pointer*/
    	printk("Hello World! %s\n", CONFIG_BOARD);
    	
    	/* Get the SPI device handle*/
    	dispDev = DEVICE_DT_GET(MYSPI_NODE);
    	if(!device_is_ready(dispDev))
    	{
    		return;
    	}
    }

    This gives me the error..

    C:\ncs\v2.1.0\zephyr\include\zephyr\device.h:831: undefined reference to `__device_dts_ord_91'

    Commenting out the device_is_ready line builds ok.

    But if I use the nrf52840dk board rather than my custom board there is no problem getting the device pointer to the spi.

    I wonder if it is a problem with my custom board?

Children
Related