Hello,
I'm building the sample Measure battery voltage on a custom board, and I have an error voltage: setup: -134 at runtime.
The overlay file is configure as explained in the sample:
And the code in the sample has not been changed.
I use the SDK v2.9.0
From what I can trace, the compatible = "voltage-divider"; will configure the .config with DT_HAS_VOLTAGE_DIVIDER_ENABLED, therefore enabling the "voltage_divider" folder located in <zephyr/drivers/sensors/voltage_divider>.
The error comes from the file voltage.c, more specifically the initialisation function called by the macro DT_INST_FOREACH_STATUS_OKAY(VOLTAGE_INIT)
The function adc_channel_setup_dt(&config->voltage.port) will fail as it is called POST_KERNEL and the parameters of the ADC are not configured yet.
The driver for adc is <zephyr/drivers/adc/adc_nrfx_saadc> and the function:
implement the adc_channel_setup.
I'm not sure where the error is coming from next, but I guess from
as the acquisition time of the ADC has never been defined, and is done at run time in the sample (therefore at APPLICATION level and not POST_KERNEL).
Could you tell me why the ADC is not configured in the overlay file for something similar as:
I checked as well the board definiton for the Nordic Thingy52 and there is not definition for the ADC, therefore I guess the error is happening as well.
Please, let me know how to get rid of that error, and correct the sample if necessay.
Thank you.