We are using GPIO1_IO3, GPIO1_IO8, and GPIO1_IO9 as 3 ADC input pins to measure DC voltage in the range of 1.6V-1.8V. The reference VREFH is DC 3.3V. I've measure on the board, these voltages are as expected.
We are seeing that ADC read in Linux (sys/bus/iio/devices/iio:devices/in_voltage0/1/2_raw) in the range of 4050-4095. For a 12 bit ADC, these are absolutely too high.
I've checked our device tree file. There seems nothing suspicious for now. There was a bug, a 3.3V applied on one ADC input. It was fixed.
I verified with memtools on the IOMUX reg configuration. They are all 0xB0.
I also tried to recalibrate ADC through memtools. When CFG.ATRIG = 0, set GC.CAL = 1. The CALF flag is 0. It sounds that calibration is good.
Here are the related parts in our device tree file.
regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;
reg_vref_3v3: regulator@1 {
compatible = "regulator-fixed";
regulator-name = "vref-3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
};
…
&adc1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_adc1>;
vref-supply = <®_vref_3v3>;
num-channels = <3>;
status = "okay";
};
….
pinctrl_adc1: adc1grp {
fsl,pins = <
MX6UL_PAD_GPIO1_IO03__GPIO1_IO03 0xb0 /* ADC_SYS4V0_SENSE (IN) */
MX6UL_PAD_GPIO1_IO09__GPIO1_IO09 0xb0 /* ADC_GEN3V6_SENSE (IN)*/
MX6UL_PAD_GPIO1_IO08__GPIO1_IO08 0xb0 /* ADC_LDO3V3_SENSE (IN)*/
>;
};