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

Trying to use nordic_nrf_temp in Zephyr open thread

I have the driver setup like all of the other sensor drivers I'm using, but I can't seem to find a device tree or Kconfig 

This should be enabled by the CONFIG_SOC_NRF52840_QIAA=y enabling config HAS_HW_NRF_TEMP

Do I need something in the board overlay, dts or ????

#define TEMP_NODE DT_INST(0, nordic_nrf_temp)

#if DT_NODE_HAS_STATUS(TEMP_NODE, okay)

#define TEMP_LABEL DT_LABEL(TEMP_NODE)

#else

#error Your devicetree has no enabled nodes with compatible "nordic,nordic_nrf_temp"

#define TEMP_LABEL "<none>"

#endif

    const struct device *chip = device_get_binding(TEMP_LABEL);

    if (chip == NULL) {

        printk("No device Nordic nrf temp found; did initialization fail?\n");

    } else {

        printk("Found device Nordic nrf temp Thermistor\n");

        fchip = true;

    }

      if (fchip) {

            ret = sensor_sample_fetch(chip);

            if (ret < 0) {

                printk("Chip Die temp Fetch error %d\n", ret);

            } else {

                struct sensor_value temp;

                sensor_channel_get(chip, SENSOR_CHAN_DIE_TEMP, &temp);

                printf("Chip die Temperature: %.2f C\n", sensor_value_to_double(&temp));

            }

        }

Parents Reply
  • Yes, that was the missing piece, hard to search for something when you don't know what you might be looking for.for the record if someone else find this, the example uses, pretty sure they are the same.

    const struct device *chip = device_get_binding("TEMP_0");

    I used

    #define TEMP_NODE DT_INST(0, nordic_nrf_temp)

    #if DT_NODE_HAS_STATUS(TEMP_NODE, okay)

    #define TEMP_LABEL DT_LABEL(TEMP_NODE)

    #else

    #error Your devicetree has no enabled nodes with compatible "nordic,nordic_nrf_temp"

    #define TEMP_LABEL "<none>"

    #endif

    and

    const struct device *chip = device_get_binding(TEMP_LABEL);

Children
No Data
Related