nRF5340 cpunet configuration problem

Hello,

I have problem with configuration.

My project is based on the project: GitHub - nordic-auko/nRF5-ble-timesync-demo: nRF52 clock synchronization demo code.
Timesync project is intended to be built on cpunet, so also my project.

I want to add additional buttons, leds, leds controlled by pwm, pin for controlling pullup, and one wire. I have problem with pwm leds. 

I made custom board based on nRF5340DK board (and I placed it in SDK folder)

in board_nrf5340_cpunet.dts I added (compared to nRF5340DK):
aliases
{
        watchdog0 = &wdt0;

        onewpu = &onewpullup;
        onewire = &onewire;
        fpwren = &fpwren;
    };
in board_nrf5340_cpuapp.dts I added:

/ {

   [ ... ]

    m_pin {
        compatible = "gpio-leds";

        onewpullup: one_w_pull_up {
            gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
            label = "one_w_pull_up";
        };

        onewire: one_wire {
            gpios = <&gpio1 5 (GPIO_PULL_UP)>;
            label = "ONE_WIRE";
        };

        fpwren: fpwr_en {
            gpios = <&gpio0 8 GPIO_PULL_UP>;
            label = "fPWR_EN";
        };

    };


   
    leds {
        compatible = "gpio-leds";

        ledr: led_r {
            gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
            label = "LED_R";
        };
        ledb: led_b {
            gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
            label = "LED_B";
        };
        ledl: led_l {
            gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
            label = "LED_L";
        };
    };

    pwmleds {
        compatible = "pwm-leds";

        pwm_led0: pwm_led_0 {
            pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
        };

        pwm_ledcr: pwm_led_c_r {
            pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
        };
        pwm_ledcg: pwm_led_c_g {
            pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
        };
        pwm_ledcb: pwm_led_c_b {
            pwms = <&pwm0 3 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
        };
    };


    buttons {
        compatible = "gpio-keys";
        buttonbtn: button_btn {
            gpios = <&gpio0 12 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
            label = "Button BTN";
            zephyr,code = <INPUT_KEY_0>;
        };
    };
};



&pwm0_default {
    group1 {
        psels = <NRF_PSEL(PWM_OUT1, 1, 3)>,
                <NRF_PSEL(PWM_OUT2, 0, 22)>,
                <NRF_PSEL(PWM_OUT3, 0, 4)>;
    };
};

&pwm0_sleep {
    group1 {
        psels = <NRF_PSEL(PWM_OUT1, 1, 3)>,
                <NRF_PSEL(PWM_OUT2, 0, 22)>,
                <NRF_PSEL(PWM_OUT3, 0, 4)>;
        /delete-property/ low-power-enable;
    };
};

&pwm1 {
    status = "disabled";
};


&uart0_sleep {
    group1 {
        psels = <NRF_PSEL(UART_TX, 0, 15)>,
                <NRF_PSEL(UART_RTS, 0, 10)>,
                <NRF_PSEL(UART_CTS, 0, 18)>,
                <NRF_PSEL(UART_RX, 0, 17)>;
        /delete-property/ low-power-enable;
    };
};
/delete-node/ &{/pin-controller/uart0_default/group2/};

&uart0_default {
    group1 {
        psels = <NRF_PSEL(UART_RTS, 0, 10)>,
                <NRF_PSEL(UART_TX, 0, 15)>,
                <NRF_PSEL(UART_CTS, 0, 18)>,
                <NRF_PSEL(UART_RX, 0, 17)>;
    };
};

&qspi_default {
    group1 {
        psels = <NRF_PSEL(QSPI_IO0, 0, 13)>,
                <NRF_PSEL(QSPI_IO1, 0, 14)>,
                <NRF_PSEL(QSPI_IO3, 0, 16)>;
    };
};

&qspi_sleep {
    group1 {
        psels = <NRF_PSEL(QSPI_IO0, 0, 13)>,
                <NRF_PSEL(QSPI_IO1, 0, 14)>,
                <NRF_PSEL(QSPI_IO3, 0, 16)>;
    };
};
in board_common.dtsi I added:
aliases
{
        watchdog0 = &wdt0;

        onewpu = &onewpullup;
        onewire = &onewire;
        fpwren = &fpwren;
    };
in board_nrf5340_cpunet-pinctrl.dtsi I added:

    m_pin {
        compatible = "gpio-leds";
    };

 
In project files in board_nrf5340_cpunet.overlay I added :

aliases
{
        syncpin = &sync_pin0;

        onewpu = &onewpullup;
        onewire = &onewire;
        fpwren = &fpwren;

        watchdog0 = &wdt0;
        pwm-ledcr = &pwm_ledcr;
        pwm-ledcg = &pwm_ledcg;
        pwm-ledcb = &pwm_ledcb;
    };

    m_pin {
        compatible = "gpio-leds";

        onewpullup: one_w_pull_up {
            gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
            label = "one_w_pull_up";
        };

        onewire: one_wire {
            gpios = <&gpio1 5 (GPIO_PULL_UP)>;
            label = "ONE_WIRE";
        };

        fpwren: fpwr_en {
            gpios = <&gpio0 8 GPIO_PULL_UP>;
            label = "fPWR_EN";
        };

    };




    leds {
        compatible = "gpio-leds";

        ledr: led_r {
            gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
            label = "LED_R";
        };
        ledb: led_b {
            gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
            label = "LED_B";
        };
        ledl: led_l {
            gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
            label = "LED_L";
        };
    };

    pwmleds {
        compatible = "pwm-leds";

        pwm_led0: pwm_led_0 {
            pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
        };

        pwm_ledcr: pwm_led_c_r {
            pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
        };
        pwm_ledcg: pwm_led_c_g {
            pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
        };
        pwm_ledcb: pwm_led_c_b {
            pwms = <&pwm0 3 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
        };
    };


    buttons {
        compatible = "gpio-keys";
        buttonbtn: button_btn {
            gpios = <&gpio0 12 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
            label = "Button BTN";
            zephyr,code = <INPUT_KEY_0>;
        };
    };

In project files in board_nrf5340_cpuapp.overlay I added :
/
{
    gpio_fwd: nrf-gpio-forwarder {
        compatible = "nordic,nrf-gpio-forwarder";
        status = "okay";
        sync-pin {
            gpios = <&gpio1 14 0>;
        };
        buttons {
            gpios = <&gpio0 23 0>, <&gpio0 24 0>, <&gpio0 8 0>, <&gpio0 9 0>;
        };
        leds {
            gpios = <&gpio0 28 0>, <&gpio0 29 0>, <&gpio0 30 0>, <&gpio0 31 0>;
        };

        pwmleds {
            gpios = <&gpio1 3 0>, <&gpio0 22 0>, <&gpio0 4 0>;
        };

        pwm_ledcr: pwm_led_c_r {
            gpios = <&gpio1 3 0>;
        };
        pwm_ledcg: pwm_led_c_g {
            gpios = <&gpio0 22 0>;
        };
        pwm_ledcb: pwm_led_c_b {
            gpios = <&gpio0 4 0>;
        };
    };
     aliases {
        pwm-led0 = &pwm_led0;
        watchdog0 = &wdt0;
        pwm-ledcr = &pwm_ledcr;
        pwm-ledcg = &pwm_ledcg;
        pwm-ledcb = &pwm_ledcb;
        onewpu = &onewpullup;
        onewire = &onewire;
        fpwren = &fpwren;
    };
};
But I have errors:
-- Found devicetree overlay: board_nrf5340_cpunet.overlay
devicetree error: /pwmleds/pwm_led_0: undefined node label 'pwm0'
CMake Error at C:/ncs/v3.1.1/zephyr/cmake/modules/dts.cmake:306 (execute_process):
execute_process failed command indexes:

1: "Child return code: 1"
Call Stack (most recent call first):
C:/ncs/v3.1.1/zephyr/cmake/modules/zephyr_default.cmake:131 (include)
C:/ncs/v3.1.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
C:/ncs/v3.1.1/zephyr/share/zephyr-package/cmak-- Configuring incomplete, errors occurred!
e/ZephyrConfig.cmake:92 (include_boilerplate)
CMakeLists.txt:8 (find_package)


CMake Error at cmake/modules/sysbuild_extensions.cmake:530 (message):
CMake configure failed for Zephyr project: timesync_proj

Location: C:/_Nordic_TimeSync_MULTI/timesync_proj
Call Stack (most recent call first):
cmake/modules/sysbuild_images.cmake:43 (ExternalZephyrProject_Cmake)
cmake/modules/sysbuild_default.cmake:21 (include)
C:/ncs/v3.1.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
C:/ncs/v3.1.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
C:/ncs/v3.1.1/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
template/CMakeLists.txt:10 (find_package)


-- Configuring incomplete, errors occurred!


When I commented lines in board_5340_cpunet.overlay file and I left these lines of code:

/
{
    sync_pin {
        compatible = "gpio-keys";
        sync_pin0: sync_pin_0 {
            gpios = <&gpio1 14 (GPIO_ACTIVE_HIGH)>; /* P1.14 */
            label = "SYNC_PIN";
        };
    };

    aliases {
        syncpin = &sync_pin0;

        onewpu = &onewpullup;
        onewire = &onewire;
        fpwren = &fpwren;
    };

    m_pin {
        compatible = "gpio-leds";

        onewpullup: one_w_pull_up {
            gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
            label = "one_w_pull_up";
        };

        onewire: one_wire {
            gpios = <&gpio1 5 (GPIO_PULL_UP)>;
            label = "ONE_WIRE";
        };

        fpwren: fpwr_en {
            gpios = <&gpio0 8 GPIO_PULL_UP>;
            label = "fPWR_EN";
        };

    };

};


I got this errors:

C:/ncs/v3.1.1/zephyr/include/zephyr/device.h:96:41: error: '__device_dts_ord_DT_N_ALIAS_pwm_ledcr_P_pwms_IDX_0_PH_ORD' undeclared here (not in a function)
96 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/devicetree.h:236:32: error: 'DT_N_ALIAS_pwm_ledcr_P_pwms_IDX_0_VAL_channel' undeclared here (not in a function)
236 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
| ^~~~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/devicetree.h:236:32: error: 'DT_N_ALIAS_pwm_ledcr_P_pwms_IDX_0_VAL_period' undeclared here (not in a function)
236 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
| ^~~~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/device.h:96:41: error: '__device_dts_ord_DT_N_ALIAS_pwm_ledcg_P_pwms_IDX_0_PH_ORD' undeclared here (not in a function)
96 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/devicetree.h:236:32: error: 'DT_N_ALIAS_pwm_ledcg_P_pwms_IDX_0_VAL_channel' undeclared here (not in a function)
236 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
| ^~~~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/devicetree.h:236:32: error: 'DT_N_ALIAS_pwm_ledcg_P_pwms_IDX_0_VAL_period' undeclared here (not in a function)
236 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
| ^~~~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/device.h:96:41: error: '__device_dts_ord_DT_N_ALIAS_pwm_ledcb_P_pwms_IDX_0_PH_ORD' undeclared here (not in a function)
96 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/devicetree.h:236:32: error: 'DT_N_ALIAS_pwm_ledcb_P_pwms_IDX_0_VAL_channel' undeclared here (not in a function)
236 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
| ^~~~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/devicetree.h:236:32: error: 'DT_N_ALIAS_pwm_ledcb_P_pwms_IDX_0_VAL_period' undeclared here (not in a function)
236 | #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias)
| ^~~~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/device.h:96:41: error: '__device_dts_ord_DT_N_NODELABEL_ledr_P_gpios_IDX_0_PH_ORD' undeclared here (not in a function)
96 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/devicetree.h:196:36: error: 'DT_N_NODELABEL_ledr_P_gpios_IDX_0_VAL_pin' undeclared here (not in a function); did you mean 'DT_N_S_norab12_fem_P_ctx_gpios_IDX_0_VAL_
pin'?
196 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
| ^~~~~~~~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/device.h:96:41: error: '__device_dts_ord_DT_N_NODELABEL_ledb_P_gpios_IDX_0_PH_ORD' undeclared here (not in a function)
96 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/devicetree.h:196:36: error: 'DT_N_NODELABEL_ledb_P_gpios_IDX_0_VAL_pin' undeclared here (not in a function); did you mean 'DT_N_S_norab12_fem_P_ctx_gpios_IDX_0_VAL_
pin'?
196 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
| ^~~~~~~~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/device.h:96:41: error: '__device_dts_ord_DT_N_NODELABEL_ledl_P_gpios_IDX_0_PH_ORD' undeclared here (not in a function)
96 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/devicetree.h:196:36: error: 'DT_N_NODELABEL_ledl_P_gpios_IDX_0_VAL_pin' undeclared here (not in a function); did you mean 'DT_N_S_norab12_fem_P_ctx_gpios_IDX_0_VAL_
pin'?
196 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
| ^~~~~~~~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/device.h:96:41: error: '__device_dts_ord_DT_N_NODELABEL_buttonbtn_P_gpios_IDX_0_PH_ORD' undeclared here (not in a function)
96 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
| ^~~~~~~~~

C:/ncs/v3.1.1/zephyr/include/zephyr/devicetree.h:196:36: error: 'DT_N_NODELABEL_buttonbtn_P_gpios_IDX_0_VAL_pin' undeclared here (not in a function)
196 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
| ^~~~~~~~~~~~~~~



What needs to be changed so that the application builds correctly?
* I am building application in VS Code with SDK v3.1.1 for cpunet
 
Best Regards
Parents Reply Children
No Data
Related