Need Help With DT_NODELABEL Not Picking Up Node Name

I am working my way through the Beginner course on Dev Academy, and am trying my hand at using my own accelerometer breakout board communicating over I2C for lesson 6. 

I am using the nrf52DK evaluation board. I can't get past the build stage.

I am getting the following error:

```

C:/embeddedProjects/ncs-fund/v2.8.x-v2.7.0/l6/l6_e1/build/l6_e1/zephyr/include/generated/zephyr/devicetree_generated.h:8394:33: error: 'DT_N_S_soc_S_i2c_40003000_S_mysensor_68' undeclared (first use in this function); did you mean 'DT_N_S_soc_S_i2c_40003000_S_mysensor_68_BUS'?
8394 | #define DT_N_NODELABEL_mysensor DT_N_S_soc_S_i2c_40003000_S_mysensor_68
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/embeddedProjects/ncs-fund/v2.8.x-v2.7.0/l6/l6_e1/build/l6_e1/zephyr/include/generated/zephyr/devicetree_generated.h:8394:33: note: in definition of macro 'DT_N_NODELABEL_mysensor'
8394 | #define DT_N_NODELABEL_mysensor DT_N_S_soc_S_i2c_40003000_S_mysensor_68
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:/embeddedProjects/ncs-fund/v2.8.x-v2.7.0/l6/l6_e1/src/main.c:32:19: note: in expansion of macro 'DT_NODELABEL'
32 | #define I2C0_NODE DT_NODELABEL(mysensor)
| ^~~~~~~~~~~~
C:/embeddedProjects/ncs-fund/v2.8.x-v2.7.0/l6/l6_e1/src/main.c:36:22: note: in expansion of macro 'I2C0_NODE'
36 | printk("%s", I2C0_NODE);
| ^~~~~~~~~
C:/embeddedProjects/ncs-fund/v2.8.x-v2.7.0/l6/l6_e1/build/l6_e1/zephyr/include/generated/zephyr/devicetree_generated.h:8394:33: note: each undeclared identifier is reported only once for each function it appears in
8394 | #define DT_N_NODELABEL_mysensor DT_N_S_soc_S_i2c_40003000_S_mysensor_68
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/embeddedProjects/ncs-fund/v2.8.x-v2.7.0/l6/l6_e1/build/l6_e1/zephyr/include/generated/zephyr/devicetree_generated.h:8394:33: note: in definition of macro 'DT_N_NODELABEL_mysensor'
8394 | #define DT_N_NODELABEL_mysensor DT_N_S_soc_S_i2c_40003000_S_mysensor_68
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:/embeddedProjects/ncs-fund/v2.8.x-v2.7.0/l6/l6_e1/src/main.c:32:19: note: in expansion of macro 'DT_NODELABEL'
32 | #define I2C0_NODE DT_NODELABEL(mysensor)
| ^~~~~~~~~~~~
C:/embeddedProjects/ncs-fund/v2.8.x-v2.7.0/l6/l6_e1/src/main.c:36:22: note: in expansion of macro 'I2C0_NODE'
36 | printk("%s", I2C0_NODE);
| ^~~~~~~~~

```

I am using the following overlay file under boards\nrf52dk_nrf52832.overlay:

```

&i2c0 {  
    mysensor: mysensor@68{
        compatible = "i2c-device";
        status = "okay";
        reg = < 0x68 >;
    };
};

```
The I2C device's address is 0x68.

Here is my code:

```

/*
 * Copyright (c) 2016 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
/* STEP 3 - Include the header file of the I2C API */
#include <zephyr/drivers/i2c.h>
/* STEP 4.1 - Include the header file of printk() */
#include <zephyr/sys/printk.h>

/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS 1000

/* STEP 8 - Define the I2C slave device address and the addresses of relevant registers */
// #define I2C_READ_ADDR 0x68
// #define I2C_WRITE_ADDR 0x69
#define I2C_ADDR 0x68 //7 bit addr: 1101000, where last bit is tied to ground via AD0
#define I2C_ACCEL_CONFIG_REGISTER 0x1C
#define I2C_READ_X_HIGH 0x3B
#define I2C_READ_X_LOW 0x3C
#define I2C_READ_Y_HIGH 0x3D
#define I2C_READ_Y_LOW 0x3E
#define I2C_READ_Z_HIGH 0x3F
#define I2C_READ_Z_LOW 0x40
/* STEP 6 - Get the node identifier of the sensor */
#define I2C0_NODE DT_NODELABEL(mysensor)
// static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(I2C0_NODE);
int main(void)
{
    printk("%s", I2C0_NODE);


    while (1) {
        /* STEP 10 - Read from sensor */
        uint8_t read_x_buf[2] = { 0 };
        // i2c_burst_read(&dev_i2c, dev_i2c.addr I2C_READ_X_HIGH, read_x_buf, 2);
        // i2c_burst_read(spec->bus, spec->addr, start_addr, buf, num_bytes);
        printk("X value is %x and %x\n\r", read_x_buf[0], read_x_buf[1]);
       

        k_msleep(SLEEP_TIME_MS);
    }
}

```

I am new to the whole concept of describing hardware through DTB files so any help would be appreciated! 

Related