ADC_CHANNEL_CFG_DT from Zephyr documentation doesn't work

The Zephyr documentation about ADC (https://docs.zephyrproject.org/latest/hardware/peripherals/adc.html) mentioned ADC_CHANNEL_CFG_DT usage in device tree and later source code. But when I copy the text from the example into my device tree file as

&adc {
    compatible = "nordic,nrf-saadc";
    status = "okay";
    label = "BattADC";
   channel@0 {
       reg = <0>;
       zephyr,gain = "ADC_GAIN_1";
       zephyr,reference = "ADC_REF_INTERNAL";
       zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 20)>;
       zephyr,input-positive = <NRF_SAADC_AIN6>;
       zephyr,input-negative = <NRF_SAADC_AIN7>;
   };

   channel@1 {
       reg = <1>;
       zephyr,gain = "ADC_GAIN_1_6";
       zephyr,reference = "ADC_REF_INTERNAL";
       zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
       zephyr,input-positive = <NRF_SAADC_AIN0>;
   };
};

I get the error "knauf_app.dts:167 (column 35): parse error: expected number or parenthesized expression" where line 167 is the acquisition-time of channel 0.

It would be great when I could use this stuff, but looking into this forum nearly no-one seems to use it. All the discussions about ADC do it by coding into the source code and nor usind device tree, except the io-channel stuff.

I'm using SDK version 1.9.1 and work with a nRF5340.

Any help how to get this into the device tree?

BR
Erwin

Parents Reply Children
No Data
Related