This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

static assertion failed: "Only one of the following peripherals can be enabled: SPI2, SPIM2, SPIS2, TWI2, TWIM2, TWIS2, UARTE2. kernel build bug

in nrf9160dk_nrf9160ns.overlay setting
/ {
    chosen {
        zephyr,console = &uart0;
        zephyr,shell-uart = &uart0;
        zephyr,uart-mcumgr = &uart0;
        zephyr,bt-mon-uart = &uart0;
    };
};

&uart0 {
        current-speed = <115200>;
        status = "okay";
        tx-pin = <1>;
        rx-pin = <0>;
        rts-pin = <0xFFFFFFFF>;
        cts-pin = <0xFFFFFFFF>;
};

&uart1 {
        current-speed = <115200>;
        status = "okay";
        tx-pin = <26>;
        rx-pin = <25>;
        rts-pin = <0xFFFFFFFF>;
        cts-pin = <0xFFFFFFFF>;
};

&uart2 {
        current-speed = <115200>;
        status = "okay";
        tx-pin = <28>;
        rx-pin = <27>;
        rts-pin = <0xFFFFFFFF>;
        cts-pin = <0xFFFFFFFF>;
};

I can use 3 uart success

and then i add one i2c

/*
 * Copyright (c) 2021 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */
/ {
    chosen {
        zephyr,console = &uart0;
        zephyr,shell-uart = &uart0;
        zephyr,uart-mcumgr = &uart0;
        zephyr,bt-mon-uart = &uart0;
    };
};

&uart0 {
        current-speed = <115200>;
        status = "okay";
        tx-pin = <1>;
        rx-pin = <0>;
        rts-pin = <0xFFFFFFFF>;
        cts-pin = <0xFFFFFFFF>;
};

&uart1 {
        current-speed = <115200>;
        status = "okay";
        tx-pin = <26>;
        rx-pin = <25>;
        rts-pin = <0xFFFFFFFF>;
        cts-pin = <0xFFFFFFFF>;
};

&uart2 {
        current-speed = <115200>;
        status = "okay";
        tx-pin = <28>;
        rx-pin = <27>;
        rts-pin = <0xFFFFFFFF>;
        cts-pin = <0xFFFFFFFF>;
};

&i2c2 {
        compatible = "nordic,nrf-twim";
    status = "okay";
    sda-pin = < 30 >;
    scl-pin = < 31 >;
        clock-frequency = <I2C_BITRATE_STANDARD>;  
};

when build them will happend

static assertion failed: "Only one of the following peripherals can be enabled: SPI2, SPIM2, SPIS2, TWI2, TWIM2, TWIS2, UARTE2. Check nodes with status \"okay\" in zephyr.dts."

after i change to

/*
 * Copyright (c) 2021 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */
/ {
    chosen {
        zephyr,console = &uart0;
        zephyr,shell-uart = &uart0;
        zephyr,uart-mcumgr = &uart0;
        zephyr,bt-mon-uart = &uart0;
    };
};

&uart0 {
        current-speed = <115200>;
        status = "okay";
        tx-pin = <1>;
        rx-pin = <0>;
        rts-pin = <0xFFFFFFFF>;
        cts-pin = <0xFFFFFFFF>;
};

&uart1 {
        current-speed = <115200>;
        status = "okay";
        tx-pin = <26>;
        rx-pin = <25>;
        rts-pin = <0xFFFFFFFF>;
        cts-pin = <0xFFFFFFFF>;
};

&uart2 {
        current-speed = <115200>;
        status = "okay";
        tx-pin = <28>;
        rx-pin = <27>;
        rts-pin = <0xFFFFFFFF>;
        cts-pin = <0xFFFFFFFF>;
};

&i2c2 {
    status = "disabled";
        sda-gpios = < &gpio0 0xFFFFFFFF 0x0 >;
        scl-gpios = < &gpio0 0xFFFFFFFF 0x0 >;
};

&i2c3 {
        compatible = "nordic,nrf-twim";
    status = "okay";
    sda-pin = < 30 >;
    scl-pin = < 31 >;
        clock-frequency = <I2C_BITRATE_STANDARD>;  
};

build success~~~~

Its a kernel problem please solve this problem

Parents
  • it check by ~/ncs/zephyr/soc/arm/nordic_nrf/validate_enabled_instances.c

    #define CHECK(idx) \
        !(I2C_ENABLED(idx) && SPI_ENABLED(idx)) && \
        !(I2C_ENABLED(idx) && UART_ENABLED(idx)) && \
        !(SPI_ENABLED(idx) && UART_ENABLED(idx))

    #define MSG(idx) \
        "Only one of the following peripherals can be enabled: " \
        "SPI"#idx", SPIM"#idx", SPIS"#idx", TWI"#idx", TWIM"#idx", TWIS"#idx \
        IF_ENABLED(CONFIG_SOC_SERIES_NRF53X, (", UARTE"#idx)) \
        IF_ENABLED(CONFIG_SOC_SERIES_NRF91X, (", UARTE"#idx)) \
        ". Check nodes with status \"okay\" in zephyr.dts."

    #if !IS_ENABLED(CONFIG_SOC_NRF52810)
    BUILD_ASSERT(CHECK(0), MSG(0));
    #endif
    BUILD_ASSERT(CHECK(1), MSG(1));
    BUILD_ASSERT(CHECK(2), MSG(2));
    BUILD_ASSERT(CHECK(3), MSG(3));

    so  maybe i2c_2 need move to i2c_3

Reply
  • it check by ~/ncs/zephyr/soc/arm/nordic_nrf/validate_enabled_instances.c

    #define CHECK(idx) \
        !(I2C_ENABLED(idx) && SPI_ENABLED(idx)) && \
        !(I2C_ENABLED(idx) && UART_ENABLED(idx)) && \
        !(SPI_ENABLED(idx) && UART_ENABLED(idx))

    #define MSG(idx) \
        "Only one of the following peripherals can be enabled: " \
        "SPI"#idx", SPIM"#idx", SPIS"#idx", TWI"#idx", TWIM"#idx", TWIS"#idx \
        IF_ENABLED(CONFIG_SOC_SERIES_NRF53X, (", UARTE"#idx)) \
        IF_ENABLED(CONFIG_SOC_SERIES_NRF91X, (", UARTE"#idx)) \
        ". Check nodes with status \"okay\" in zephyr.dts."

    #if !IS_ENABLED(CONFIG_SOC_NRF52810)
    BUILD_ASSERT(CHECK(0), MSG(0));
    #endif
    BUILD_ASSERT(CHECK(1), MSG(1));
    BUILD_ASSERT(CHECK(2), MSG(2));
    BUILD_ASSERT(CHECK(3), MSG(3));

    so  maybe i2c_2 need move to i2c_3

Children
No Data
Related