Hi,
I am trying to create a I2C slave application on the nrF Connect 2.9 SDK for nRF51840. But I have trouble tor enable the twis driver (e.g. the irq_hanlder is not included).
In the first attempt I will not create a driver for the master device on the I2C bus. Just creating the I2C slave handling in "user space". The nRF52840 is supposed to simulate an Honnywell sensor with an I2C interface.
Here is an overview of the configuration I have done.
In proj.conf:
CONFIG_NRFX_TWIS1=y
In the .overlay file:
&i2c1 { compatible = "nordic,nrfx-twis"; clock-frequency = <400000>; pinctrl-0 = <&i2c1_honeywell>; pinctrl-1 = <&i2c1_honeywell_sleep>; pinctrl-names = "default", "sleep"; interrupts = < 0x4 NRF_DEFAULT_IRQ_PRIORITY >; honeywell1:honeywell@49 { label = "i2c nRF52840 addr 0x49"; reg = <0x49>; }; status = "okay"; }; &pinctrl { i2c1_honeywell: i2c1_honeywell { group1 { psels = <NRF_PSEL(TWIM_SDA, 1, 8)>, <NRF_PSEL(TWIM_SCL, 1, 9)>; }; }; i2c1_honeywell_sleep: i2c1_honeywell_sleep { group1 { psels = <NRF_PSEL(TWIM_SDA, 1, 8)>, <NRF_PSEL(TWIM_SCL, 1, 9)>; low-power-enable; }; }; };
My code (Only essential lines shown):
#include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/drivers/gpio.h> #include <zephyr/logging/log.h> #include <nrfx_twis.h> LOG_MODULE_REGISTER(flow_meter_simulator, LOG_LEVEL_DBG); PINCTRL_DT_DEFINE(DT_NODELABEL(i2c1)); static const uint32_t m_twis_addr0 = DT_REG_ADDR(DT_NODELABEL(honeywell1)); const struct pinctrl_dev_config *m_twis_pcfg = PINCTRL_DT_DEV_CONFIG_GET(DT_NODELABEL(i2c1)); static const uint8_t m_twis_prio = DT_IRQ(DT_NODELABEL(i2c1), priority); #define NRFX_TWIS1_INST_IDX 0 #define TWIS_INST 1 const nrfx_twis_t m_twis = NRFX_TWIS_INSTANCE(TWIS_INST); static void twis_event_handler(nrfx_twis_evt_t const *const p_event) { uint8_t incr = 0; LOG_DBG("TWIS EVT handler"); switch (p_event->type) { *** Cut *** } } void flow_meter_simulator_init(void) { int err; IRQ_CONNECT(DT_IRQN(DT_NODELABEL(i2c1)), DT_IRQ(DT_NODELABEL(i2c1), priority), nrfx_isr, twis_event_handler, 0); nrfx_twis_config_t dt_config = {0}; /* Configure the I2C address */ dt_config.addr[0] = m_twis_addr0; dt_config.addr[1] = 0; /* Configure the pins */ const struct pinctrl_state *state = &m_twis_pcfg->states[PINCTRL_STATE_DEFAULT]; for (int i = 0 ; i < state->pin_cnt ; i++) /* There must be a better solution on this */ { switch(NRF_GET_FUN(state->pins[i])) { case NRF_FUN_TWIM_SCL: dt_config.scl_pin = NRF_GET_PIN(state->pins[i]); break; case NRF_FUN_TWIM_SDA: dt_config.sda_pin = NRF_GET_PIN(state->pins[i]); break; } } dt_config.scl_pull = NRF_GPIO_PIN_PULLUP; dt_config.sda_pull = NRF_GPIO_PIN_PULLUP; dt_config.interrupt_priority = m_twis_prio; LOG_DBG("\nI2C Slave: ADDR: 0x%x, SCL: %d, SDA: %d, int_pri: %d", dt_config.addr[0], dt_config.scl_pin, dt_config.sda_pin, dt_config.interrupt_priority); /* Initialize the peripheral driver */ if((err = nrfx_twis_init(&m_twis, &dt_config, twis_event_handler)) == NRFX_SUCCESS) { nrfx_twis_enable(&m_twis); LOG_DBG("\nnrfx twis initialized."); } else LOG_DBG("\nERROR: nrfx_twis_init(): %d", -err); }
The device tree compiling OK, but compiling the user code generates a lot of errors:
Building Code C:\Windows\system32\cmd.exe /d /s /c "west build --build-dir c:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/build --domain Code" -- west build: building domain(s): Code [26/160] Building C object CMakeFiles/app.dir/src/flow_meter_simulator.c.obj FAILED: CMakeFiles/app.dir/src/flow_meter_simulator.c.obj C:\ncs\toolchains\b620d30767\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DK_HEAP_MEM_POOL_SIZE=155648 -DNRF52840_XXAA -DPICOLIBC_LONG_LONG_PRINTF_SCANF -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v2.9.0/nrf/drivers/mpsl/clock_control -IC:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/build/Code/zephyr/include/generated/zephyr -IC:/ncs/v2.9.0/zephyr/include -IC:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/build/Code/zephyr/include/generated -IC:/ncs/v2.9.0/zephyr/soc/nordic -IC:/ncs/v2.9.0/zephyr/soc/nordic/nrf52/. -IC:/ncs/v2.9.0/zephyr/soc/nordic/common/. -IC:/ncs/v2.9.0/zephyr/subsys/bluetooth -IC:/ncs/v2.9.0/nrf/include -IC:/ncs/v2.9.0/nrf/lib/multithreading_lock/. -IC:/ncs/v2.9.0/nrf/subsys/bluetooth/controller/. -IC:/ncs/v2.9.0/nrf/tests/include -IC:/ncs/v2.9.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.9.0/zephyr/modules/cmsis/. -IC:/ncs/v2.9.0/modules/hal/nordic/nrfx -IC:/ncs/v2.9.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.9.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.9.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.9.0/modules/debug/segger/SEGGER -IC:/ncs/v2.9.0/modules/debug/segger/Config -IC:/ncs/v2.9.0/modules/crypto/tinycrypt/lib/include -IC:/ncs/v2.9.0/nrfxlib/softdevice_controller/include -IC:/ncs/v2.9.0/nrfxlib/mpsl/fem/common/include -IC:/ncs/v2.9.0/nrfxlib/mpsl/fem/nrf21540_gpio/include -IC:/ncs/v2.9.0/nrfxlib/mpsl/fem/nrf21540_gpio_spi/include -IC:/ncs/v2.9.0/nrfxlib/mpsl/fem/nrf2220/include -IC:/ncs/v2.9.0/nrfxlib/mpsl/fem/nrf2240/include -IC:/ncs/v2.9.0/nrfxlib/mpsl/fem/nrf22xx/include -IC:/ncs/v2.9.0/nrfxlib/mpsl/fem/simple_gpio/include -IC:/ncs/v2.9.0/nrfxlib/mpsl/fem/include -IC:/ncs/v2.9.0/nrfxlib/mpsl/fem/include/protocol -IC:/ncs/v2.9.0/nrfxlib/mpsl/include -IC:/ncs/v2.9.0/nrfxlib/mpsl/include/protocol -isystem C:/ncs/v2.9.0/zephyr/lib/libc/common/include -isystem C:/ncs/v2.9.0/nrfxlib/crypto/nrf_cc310_platform/include -Os -DNDEBUG -fno-strict-aliasing -Os -imacros C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/build/Code/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=C:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.9.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.9.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.9.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c99 -MD -MT CMakeFiles/app.dir/src/flow_meter_simulator.c.obj -MF CMakeFiles\app.dir\src\flow_meter_simulator.c.obj.d -o CMakeFiles/app.dir/src/flow_meter_simulator.c.obj -c C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/src/flow_meter_simulator.c In file included from C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_macro.h:34, from C:/ncs/v2.9.0/zephyr/include/zephyr/irq_multilevel.h:16, from C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:20, from C:/ncs/v2.9.0/zephyr/include/zephyr/device.h:12, from C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/src/flow_meter_simulator.c:7: C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/build/Code/zephyr/include/generated/zephyr/devicetree_generated.h:14980:38: warning: implicit declaration of function 'DT_N_S_soc_S_i2c_40004000_P_pinctrl_0_IDX_0_PH_FOREACH_CHILD_VARGS'; did you mean 'DT_N_S_soc_S_i2c_40003000_S_tsc2007_48_FOREACH_CHILD_VARGS'? [-Wimplicit-function-declaration] 14980 | #define DT_N_NODELABEL_i2c1 DT_N_S_soc_S_i2c_40004000 | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:72:26: note: in definition of macro '__DEBRACKET' 72 | #define __DEBRACKET(...) __VA_ARGS__ | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET' 64 | __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code) | ^~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:59:9: note: in expansion of macro '__COND_CODE' 59 | __COND_CODE(_XXXX##_flag, _if_1_code, _else_code) | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_macro.h:180:9: note: in expansion of macro 'Z_COND_CODE_1' 180 | Z_COND_CODE_1(_flag, _if_1_code, _else_code) | ^~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:146:9: note: in expansion of macro 'COND_CODE_1' 146 | COND_CODE_1(Z_PINCTRL_SKIP_STATE(state_idx, node_id), (), \ | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:2908:9: note: in expansion of macro 'DT_CAT' 2908 | DT_CAT(node_id, _FOREACH_CHILD_VARGS)(fn, __VA_ARGS__) | ^~~~~~ c:\ncs\v2.9.0\zephyr\soc\nordic\common\pinctrl_soc.h:95:10: note: in expansion of macro 'DT_FOREACH_CHILD_VARGS' 95 | {DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), \ | ^~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:1629:9: note: in expansion of macro 'DT_CAT6' 1629 | DT_CAT6(node_id, _P_, prop, _IDX_, idx, _PH) | ^~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:1642:35: note: in expansion of macro 'DT_PHANDLE_BY_IDX' 1642 | #define DT_PHANDLE(node_id, prop) DT_PHANDLE_BY_IDX(node_id, prop, 0) | ^~~~~~~~~~~~~~~~~ c:\ncs\v2.9.0\zephyr\soc\nordic\common\pinctrl_soc.h:95:33: note: in expansion of macro 'DT_PHANDLE' 95 | {DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), \ | ^~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:149:9: note: in expansion of macro 'Z_PINCTRL_STATE_PINS_INIT' 149 | Z_PINCTRL_STATE_PINS_INIT(node_id, pinctrl_ ## state_idx))) | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_listify.h:18:9: note: in expansion of macro 'Z_PINCTRL_STATE_PINS_DEFINE' 18 | F(0, __VA_ARGS__) | ^ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_listify.h:21:9: note: in expansion of macro 'Z_UTIL_LISTIFY_1' 21 | Z_UTIL_LISTIFY_1(F, sep, __VA_ARGS__) __DEBRACKET sep \ | ^~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in expansion of macro 'Z_UTIL_LISTIFY_2' 105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__ | ^ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:242:9: note: in expansion of macro 'LISTIFY' 242 | LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \ | ^~~~~~~ C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/src/flow_meter_simulator.c:35:1: note: in expansion of macro 'PINCTRL_DT_DEFINE' 35 | PINCTRL_DT_DEFINE(DT_NODELABEL(i2c1)); | ^~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:4877:24: note: in expansion of macro 'DT_N_NODELABEL_i2c1' 4877 | #define DT_CAT(a1, a2) a1 ## a2 | ^~ C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:200:29: note: in expansion of macro 'DT_CAT' 200 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label) | ^~~~~~ C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/src/flow_meter_simulator.c:35:19: note: in expansion of macro 'DT_NODELABEL' 35 | PINCTRL_DT_DEFINE(DT_NODELABEL(i2c1)); | ^~~~~~~~~~~~ c:\ncs\v2.9.0\zephyr\soc\nordic\common\pinctrl_soc.h:96:33: error: 'DT_FOREACH_PROP_ELEM_VARGS' undeclared here (not in a function) 96 | DT_FOREACH_PROP_ELEM_VARGS, psels, \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:72:26: note: in definition of macro '__DEBRACKET' 72 | #define __DEBRACKET(...) __VA_ARGS__ | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET' 64 | __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code) | ^~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:59:9: note: in expansion of macro '__COND_CODE' 59 | __COND_CODE(_XXXX##_flag, _if_1_code, _else_code) | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_macro.h:180:9: note: in expansion of macro 'Z_COND_CODE_1' 180 | Z_COND_CODE_1(_flag, _if_1_code, _else_code) | ^~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:146:9: note: in expansion of macro 'COND_CODE_1' 146 | COND_CODE_1(Z_PINCTRL_SKIP_STATE(state_idx, node_id), (), \ | ^~~~~~~~~~~ c:\ncs\v2.9.0\zephyr\soc\nordic\common\pinctrl_soc.h:95:10: note: in expansion of macro 'DT_FOREACH_CHILD_VARGS' 95 | {DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), \ | ^~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:149:9: note: in expansion of macro 'Z_PINCTRL_STATE_PINS_INIT' 149 | Z_PINCTRL_STATE_PINS_INIT(node_id, pinctrl_ ## state_idx))) | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_listify.h:18:9: note: in expansion of macro 'Z_PINCTRL_STATE_PINS_DEFINE' 18 | F(0, __VA_ARGS__) | ^ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_listify.h:21:9: note: in expansion of macro 'Z_UTIL_LISTIFY_1' 21 | Z_UTIL_LISTIFY_1(F, sep, __VA_ARGS__) __DEBRACKET sep \ | ^~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in expansion of macro 'Z_UTIL_LISTIFY_2' 105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__ | ^ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:242:9: note: in expansion of macro 'LISTIFY' 242 | LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \ | ^~~~~~~ C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/src/flow_meter_simulator.c:35:1: note: in expansion of macro 'PINCTRL_DT_DEFINE' 35 | PINCTRL_DT_DEFINE(DT_NODELABEL(i2c1)); | ^~~~~~~~~~~~~~~~~ c:\ncs\v2.9.0\zephyr\soc\nordic\common\pinctrl_soc.h:96:61: error: 'psels' undeclared here (not in a function) 96 | DT_FOREACH_PROP_ELEM_VARGS, psels, \ | ^~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:72:26: note: in definition of macro '__DEBRACKET' 72 | #define __DEBRACKET(...) __VA_ARGS__ | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET' 64 | __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code) | ^~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:59:9: note: in expansion of macro '__COND_CODE' 59 | __COND_CODE(_XXXX##_flag, _if_1_code, _else_code) | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_macro.h:180:9: note: in expansion of macro 'Z_COND_CODE_1' 180 | Z_COND_CODE_1(_flag, _if_1_code, _else_code) | ^~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:146:9: note: in expansion of macro 'COND_CODE_1' 146 | COND_CODE_1(Z_PINCTRL_SKIP_STATE(state_idx, node_id), (), \ | ^~~~~~~~~~~ c:\ncs\v2.9.0\zephyr\soc\nordic\common\pinctrl_soc.h:95:10: note: in expansion of macro 'DT_FOREACH_CHILD_VARGS' 95 | {DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), \ | ^~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:149:9: note: in expansion of macro 'Z_PINCTRL_STATE_PINS_INIT' 149 | Z_PINCTRL_STATE_PINS_INIT(node_id, pinctrl_ ## state_idx))) | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_listify.h:18:9: note: in expansion of macro 'Z_PINCTRL_STATE_PINS_DEFINE' 18 | F(0, __VA_ARGS__) | ^ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_listify.h:21:9: note: in expansion of macro 'Z_UTIL_LISTIFY_1' 21 | Z_UTIL_LISTIFY_1(F, sep, __VA_ARGS__) __DEBRACKET sep \ | ^~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in expansion of macro 'Z_UTIL_LISTIFY_2' 105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__ | ^ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:242:9: note: in expansion of macro 'LISTIFY' 242 | LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \ | ^~~~~~~ C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/src/flow_meter_simulator.c:35:1: note: in expansion of macro 'PINCTRL_DT_DEFINE' 35 | PINCTRL_DT_DEFINE(DT_NODELABEL(i2c1)); | ^~~~~~~~~~~~~~~~~ c:\ncs\v2.9.0\zephyr\soc\nordic\common\pinctrl_soc.h:97:33: error: 'Z_PINCTRL_STATE_PIN_INIT' undeclared here (not in a function) 97 | Z_PINCTRL_STATE_PIN_INIT, node_id)} | ^~~~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:72:26: note: in definition of macro '__DEBRACKET' 72 | #define __DEBRACKET(...) __VA_ARGS__ | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET' 64 | __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code) | ^~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:59:9: note: in expansion of macro '__COND_CODE' 59 | __COND_CODE(_XXXX##_flag, _if_1_code, _else_code) | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_macro.h:180:9: note: in expansion of macro 'Z_COND_CODE_1' 180 | Z_COND_CODE_1(_flag, _if_1_code, _else_code) | ^~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:146:9: note: in expansion of macro 'COND_CODE_1' 146 | COND_CODE_1(Z_PINCTRL_SKIP_STATE(state_idx, node_id), (), \ | ^~~~~~~~~~~ c:\ncs\v2.9.0\zephyr\soc\nordic\common\pinctrl_soc.h:95:10: note: in expansion of macro 'DT_FOREACH_CHILD_VARGS' 95 | {DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), \ | ^~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:149:9: note: in expansion of macro 'Z_PINCTRL_STATE_PINS_INIT' 149 | Z_PINCTRL_STATE_PINS_INIT(node_id, pinctrl_ ## state_idx))) | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_listify.h:18:9: note: in expansion of macro 'Z_PINCTRL_STATE_PINS_DEFINE' 18 | F(0, __VA_ARGS__) | ^ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_listify.h:21:9: note: in expansion of macro 'Z_UTIL_LISTIFY_1' 21 | Z_UTIL_LISTIFY_1(F, sep, __VA_ARGS__) __DEBRACKET sep \ | ^~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in expansion of macro 'Z_UTIL_LISTIFY_2' 105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__ | ^ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:242:9: note: in expansion of macro 'LISTIFY' 242 | LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \ | ^~~~~~~ C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/src/flow_meter_simulator.c:35:1: note: in expansion of macro 'PINCTRL_DT_DEFINE' 35 | PINCTRL_DT_DEFINE(DT_NODELABEL(i2c1)); | ^~~~~~~~~~~~~~~~~ C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/build/Code/zephyr/include/generated/zephyr/devicetree_generated.h:14980:38: error: 'DT_N_S_soc_S_i2c_40004000' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_i2c_40004000_ORD'? 14980 | #define DT_N_NODELABEL_i2c1 DT_N_S_soc_S_i2c_40004000 | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:72:26: note: in definition of macro '__DEBRACKET' 72 | #define __DEBRACKET(...) __VA_ARGS__ | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET' 64 | __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code) | ^~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:59:9: note: in expansion of macro '__COND_CODE' 59 | __COND_CODE(_XXXX##_flag, _if_1_code, _else_code) | ^~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_macro.h:180:9: note: in expansion of macro 'Z_COND_CODE_1' 180 | Z_COND_CODE_1(_flag, _if_1_code, _else_code) | ^~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:146:9: note: in expansion of macro 'COND_CODE_1' 146 | COND_CODE_1(Z_PINCTRL_SKIP_STATE(state_idx, node_id), (), \ | ^~~~~~~~~~~ c:\ncs\v2.9.0\zephyr\soc\nordic\common\pinctrl_soc.h:95:10: note: in expansion of macro 'DT_FOREACH_CHILD_VARGS' 95 | {DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), \ | ^~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:149:9: note: in expansion of macro 'Z_PINCTRL_STATE_PINS_INIT' 149 | Z_PINCTRL_STATE_PINS_INIT(node_id, pinctrl_ ## state_idx))) | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_listify.h:18:9: note: in expansion of macro 'Z_PINCTRL_STATE_PINS_DEFINE' 18 | F(0, __VA_ARGS__) | ^ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_listify.h:21:9: note: in expansion of macro 'Z_UTIL_LISTIFY_1' 21 | Z_UTIL_LISTIFY_1(F, sep, __VA_ARGS__) __DEBRACKET sep \ | ^~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in expansion of macro 'Z_UTIL_LISTIFY_2' 105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__ | ^ C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/pinctrl.h:242:9: note: in expansion of macro 'LISTIFY' 242 | LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \ | ^~~~~~~ C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/src/flow_meter_simulator.c:35:1: note: in expansion of macro 'PINCTRL_DT_DEFINE' 35 | PINCTRL_DT_DEFINE(DT_NODELABEL(i2c1)); | ^~~~~~~~~~~~~~~~~ C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:4877:24: note: in expansion of macro 'DT_N_NODELABEL_i2c1' 4877 | #define DT_CAT(a1, a2) a1 ## a2 | ^~ C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:200:29: note: in expansion of macro 'DT_CAT' 200 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label) | ^~~~~~ C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/src/flow_meter_simulator.c:35:19: note: in expansion of macro 'DT_NODELABEL' 35 | PINCTRL_DT_DEFINE(DT_NODELABEL(i2c1)); | ^~~~~~~~~~~~ [41/160] Building C object zephyr/kernel/CMakeFiles/kernel.dir/poll.c.obj ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\b620d30767\opt\bin\cmake.EXE' --build C:/Users/KasperLeonhardt/Projects/TestDevices/PF_Sim/Code/build/Code
In my first attempt 'compatible' was set to "nordic,nrfx-twi" in the overlay file, the project builds, but I forgot the "s" to enable the TWIS instead of the TWI driver.
Any clues?
Regards
Kasper.