Hello,
I am trying to do my own i2c read/write from a sensor, and I followed the twim example available with the SDK.
When I build the project, I get errors wherever I have I2C related macros:
\ncs\v1.7.0\zephyr\include\devicetree.h:177:36: error: 'DT_N_NODELABEL_i2c_addr_REG_IDX_0_VAL_ADDRESS' was not declared in this scope 177 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
\ncs\v1.7.0\zephyr\include\devicetree.h:2542:24: note: in definition of macro 'DT_CAT' 2542 | #define DT_CAT(a1, a2) a1 ## a2
\ncs\v1.7.0\zephyr\include\devicetree.h:1355:30: note: in expansion of macro 'DT_REG_ADDR_BY_IDX' 1355 | #define DT_REG_ADDR(node_id) DT_REG_ADDR_BY_IDX(node_id, 0)
And so on. Essentially whenever I use these macro definitions in code it also spits out an error.
I made sure to define the device overlay and setup the i2c similar to the tutorial. The address of my sensor is 0x32:
&i2c1 { /* a */ compatible = "nordic,nrf-twim"; /* b */ status = "okay"; /* c */ clock-frequency = <100000>; /* d */ twis_device1:nRF52840@32 { /* e */ // device compatible /* f */ label = "zmod addr 0x32"; /* g */ reg = <0x32>; /* h */ }; };
I also made sure to enable i2c in proj.conf: