DTS own node DT_N_S_ undeclared


Piotr Barszczewski <piotr@...>
 

Hello,

I'm writing an application for nrf52832 based board ADC + voltage divider functionalty as in the great nRF battery example https://docs.zephyrproject.org/latest/samples/boards/nrf/battery/README.html. I'm adapting it to support multiple vbatt nodes from DTS and while on the code layer it's quite simple I'm struggling with the DTS. 

My board dts file contains this part:

#include <nordic/nrf52832_qfaa.dtsi>
/ {
    model = "vendor my_board";
    compatible = nordic,nrf52832-qfaa","nordic,nrf52832";
    // ...
    vbatt {
        vbatt_lipo: vbatt0  {
            compatible = "voltage-divider";
            io-channels = <&adc 6>;    /* P0.30 = AIN6 */
            output-ohms = <3300000>;
            full-ohms = <(3300000 + 4700000)>;
            status = "okay";
        };
        vbatt_cr: vbatt1  {
            compatible = "voltage-divider";
            io-channels = <&adc 1>;    /* P0.03 = AIN1 */
            output-ohms = <3300000>;
            full-ohms = <(3300000 + 4700000)>;
            status = "okay";
        };
    };
    // ...
};

The devicetree snippet seems ok

/* Existence and alternate IDs: */
#define DT_N_S_vbatt_S_vbatt0_EXISTS 1
#define DT_N_INST_0_voltage_divider DT_N_S_vbatt_S_vbatt0
#define DT_N_NODELABEL_vbatt_lipo   DT_N_S_vbatt_S_vbatt0

except for the DT_N_S_vbatt_S_vbatt0 which is not defined anywhere and as a result I'm getting:

    zephyr/include/devicetree.h:73:17: error: 'DT_N_S_vbatt_S_vbatt_lipo' undeclared here (not in a function); did you mean 'DT_N_S_vbatt_S_vbatt_lipo_ORD'?

What else should I do to make my own DTS node be usable in the source file? I'm following the docs, referencing it by #define VBATT_LIPO DT_PATH(vbatt, vbatt_lipo) which is in line with the guides and docs but the DT_N_S_* is missing and I don't have a clue on how could I fix this.
Did anyone experience this before and could point me to where I could find a solution? Been trying for days now without result.

Best regards

Join users@lists.zephyrproject.org to automatically receive all group messages.