This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3352: ADC problem. Strange measurements after changing the kernel from 4.4.197 to 6.1

Part Number: AM3352
Other Parts Discussed in Thread: TPS65217

I updated my project based on AM3352. I changed Buildroot 2016.02 to 2023.05.1 and updated the kernel from 4.4.197 to 6.1. I have adapted DTS to the new kernel. There is a problem with the ADC when measuring the battery on channel 7. On the old kernel, the measurement worked, with the new kernel, the driver seems to be working, but the measurement is strange, it measures something and does not change when I connect the batteries. I tested the same HW on the old and the new one. So it's not a problem with HW.


Old kernel and DTS fragment:

/* TPS65217 charger */
&tps {
	tps65217-charger {
		compatible = "ti,tps65217-charger";
	};
};

/* ADC channel 7 for TPS65217 MUX_OUT */
&tscadc {
	status = "okay";

	adc {
		ti,adc-channels = <7>;
	};
};


Battery disconnected:
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw
160
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw
161
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw
161
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw
159
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw




New kernel and DTS fragment:
/* TPS65217 charger */
&tps {
	interrupt-parent = <&intc>;
	interrupts = <7>; /* NNMI */

	charger {
		status = "okay";
	};

};

/* ADC channel 7 for TPS65217 MUX_OUT */
&tscadc {
	status = "okay";

	adc {
		ti,adc-channels = <7>;
	};
};



Here the measurement is the same when the battery is connected or disconnected

# cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw 
646 
# cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw 
643 
# cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw 
641 
# cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw 
639 


I have configured other channels and the situation is similar:

# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw 
462
565
559
623
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw 
462
564
556
618
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw 
462
565
557
619
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw 
461
564
557
610
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw 
462
565
556
612
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw 
460
564
557
618
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw 
463
565
557
613

  • Hello,

    1) What is the actual voltage that you are applying to the pins?

    2) Please show your pinmux settings for the ADC pins.

    3) Are there any circuits attached to the ADC pins we should be aware of?

    Regards,

    Nick

  • The problem is solved. It turned out that I did not activate pinmux in the driver in TPS65217.

         /*
         * To read battery voltage set MUXCTRL reg to 001 - VBAT.
         * This wires battery voltage via MUX_OUT with analog input of sys board.
         * Voltage from MUX_OUT is divided by 3.
         */
        ret = tps65217_set_bits(tps, TPS65217_REG_MUXCTRL,
                0x01,
                TPS65217_MUXCTRL_MUX_MASK,
                TPS65217_PROTECT_NONE);

  • There is another problem with TPS65217. The voltage on VBAT appears even when the battery is not connected. But that's a topic for another thread.

    # cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw
    2795
    # cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw
    2783
    # cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw
    285
    # cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw
    495
    # cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw
    2795
    # cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw
    312
    # cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw
    2788
    

  • Hello Kacper,

    Glad to hear that you are able to move forward! Feel free to create additional threads as needed.

    Regards,

    Nick