I am trying to use the battery example in "/ncs/zephyr/samples/boards/nrf/battery" to measure my 3V coin cell via VDD. I am using P0.14 to enable a set load on VDD before the battery measurement.
In the past I have used NRF_SAADC_INPUT_VDD to successfully read the battery voltage via VDD.
What do I need to put for the "io_channel" in the dts file for the following vbatt? Is anything else missing.
vbatt { compatible = "voltage-divider"; io-channels = <&adc 4>; output-ohms = <180000>; full-ohms = <(1500000 + 180000)>; power-gpios = <&sx1509b 4 0>; };
Following is my "battery_def.h" file. I haven't done the calculations for the battery voltage state of charge yet, this is just my modified version of the one from "nrf52840gmouse_nrf52840".
The following is from my proj.conf file.
CONFIG_GPIO=y #Enable Battery Readings https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/doc/battery_meas.html CONFIG_ADC=y CONFIG_ADC_ASYNC=y #CONFIG_ADC_0=y CONFIG_ADC_NRFX_SAADC=y # P0.31 is the Battery measurement enable pin. CONFIG_DESKTOP_BATTERY_MEAS_HAS_ENABLE_PIN=31 CONFIG_DESKTOP_BATTERY_MEAS_MIN_LEVEL=2 CONFIG_DESKTOP_BATTERY_MEAS_MAX_LEVEL=3 # Difference in mV between the adjacent elements in the conversion lookup table. # CONFIG_DESKTOP_VOLTAGE_TO_SOC_DELTA= # The amount of time between the subsequent battery measurements (in ms). CONFIG_DESKTOP_BATTERY_MEAS_POLL_INTERVAL_MS=1000