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.

AM4378: Am4378 ADC1 Driver support

Part Number: AM4378

Hi ,

I understand that the TI SDK currently does not support the ADC1 driver. Are there any updates or plans regarding ADC1 driver support?

Currently we are connected ADC1 pins to GND, is there any possibility that we can use as GPIO?

Regards,

Rehaman

  • Hi,

    The thread owner is out of office till until week of Feb 17. Please ping the thread if you do not get an update during that week.

    Thank you for your patience.

    Regards,
    Harshith

  • Any update on the query?

  • Hello Rehaman,

    Thank you for the ping.

    AM437x ADC1 is added to the ti_am335x_tscadc driver starting in kernel 6.1

    It looks like a member of the Linux community added support for ADC1 on the AM437x back in 2021. You can find their patches here:
    https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/log/drivers/mfd/ti_am335x_tscadc.c?h=ti-linux-6.1.y-cicd

    This code is in the TI SDKs starting with AM437x SDK 9.1 / Linux kernel 6.1, and still there in the latest AM437x SDK 11.2 / Linux kernel 6.12:

    // magadc is not in SDK 8.2
    ~/sdks/ti-processor-sdk-linux-am335x-evm-08
    .02.00.24/board-support/linux-5.10.100+gitAUTOINC+7a7a3af903-g7a7a3a
    f903/arch/arm/boot/dts$ grep -r --include=am437* adc
    am437x-cm-t43.dts:&tscadc {
    am437x-cm-t43.dts:      adc {
    am437x-cm-t43.dts:              ti,adc-channels = <4 5 6 7>;
    am437x-gp-evm.dts:                      AM4372_IOPAD(0xadc, PIN_INPUT_PULLDOWN | MUX_MODE7)
    am437x-gp-evm.dts:               * 0x264 represents the offset of padconf register of
    am437x-gp-evm.dts:&tscadc {
    am437x-gp-evm.dts:      adc {
    am437x-gp-evm.dts:              ti,adc-channels = <0 1 2 3 4 5 6 7>;
    am437x-l4.dtsi:                 tscadc: tscadc@0 {
    am437x-l4.dtsi:                         compatible = "ti,am3359-tscadc";                                                               am437x-l4.dtsi:                         clocks = <&adc_tsc_fck>;
    am437x-l4.dtsi:                         adc {                                                                                          am437x-l4.dtsi:                                 compatible = "ti,am3359-adc";
    am437x-l4.dtsi:                                 compatible = "ti,am437-padconf",
    
    
    // it is in SDK 9.1:
    ~/sdks/ti-processor-sdk-linux-am335x-evm-09.01.00.001/board-support/ti-linux-kernel-6.1.46+gitAUTOINC+1d4b5da681-g1d4b5da681/arch/arm/boot/dts$ grep -r --include=am437* adc
    am437x-cm-t43.dts:&tscadc {
    am437x-cm-t43.dts:      adc {
    am437x-cm-t43.dts:              ti,adc-channels = <4 5 6 7>;
    am437x-gp-evm.dts:                      AM4372_IOPAD(0xadc, PIN_INPUT_PULLDOWN | MUX_MODE7)
    am437x-gp-evm.dts:               * 0x264 represents the offset of padconf register of
    am437x-gp-evm.dts:&tscadc {
    am437x-gp-evm.dts:      adc {
    am437x-gp-evm.dts:              ti,adc-channels = <0 1 2 3 4 5 6 7>;
    am437x-gp-evm.dts:&magadc {
    am437x-gp-evm.dts:      adc {
    am437x-gp-evm.dts:              ti,adc-channels = <0 1 2 3 4 5 6 7>;
    am437x-l4.dtsi:                 tscadc: tscadc@0 {
    am437x-l4.dtsi:                         compatible = "ti,am3359-tscadc";
    am437x-l4.dtsi:                         clocks = <&adc_tsc_fck>;
    am437x-l4.dtsi:                         adc {
    am437x-l4.dtsi:                                 compatible = "ti,am3359-adc";
    am437x-l4.dtsi:                                 compatible = "ti,am437-padconf",
    am437x-l4.dtsi:                 magadc: magadc@0 {
    am437x-l4.dtsi:                         compatible = "ti,am4372-magadc";
    am437x-l4.dtsi:                         clocks = <&adc_mag_fck>;
    am437x-l4.dtsi:                         adc {
    am437x-l4.dtsi:                                 compatible = "ti,am4372-adc";
    
    // and also the latest SDK 11.2
    ~/sdks/ti-processor-sdk-linux-am335x-evm-11.02.05.02/board-support/ti-linux-kernel-6.12.49+git-ti/arch/arm/boot/dts/ti/omap$ grep -r --include=am437* adc
    am437x-cm-t43.dts:&tscadc {
    am437x-cm-t43.dts:      adc {
    am437x-cm-t43.dts:              ti,adc-channels = <4 5 6 7>;
    am437x-gp-evm.dts:                      AM4372_IOPAD(0xadc, PIN_INPUT_PULLDOWN | MUX_MODE7)
    am437x-gp-evm.dts:               * 0x264 represents the offset of padconf register of
    am437x-gp-evm.dts:&tscadc {
    am437x-gp-evm.dts:      adc {
    am437x-gp-evm.dts:              ti,adc-channels = <0 1 2 3 4 5 6 7>;
    am437x-gp-evm.dts:&magadc {
    am437x-gp-evm.dts:      adc {
    am437x-gp-evm.dts:              ti,adc-channels = <0 1 2 3 4 5 6 7>;
    am437x-l4.dtsi:                 tscadc: tscadc@0 {
    am437x-l4.dtsi:                         compatible = "ti,am3359-tscadc";
    am437x-l4.dtsi:                         clocks = <&adc_tsc_fck>;
    am437x-l4.dtsi:                         adc {
    am437x-l4.dtsi:                                 compatible = "ti,am3359-adc";
    am437x-l4.dtsi:                                 compatible = "ti,am437-padconf",
    am437x-l4.dtsi:                 magadc: magadc@0 {
    am437x-l4.dtsi:                         compatible = "ti,am4372-magadc";
    am437x-l4.dtsi:                         clocks = <&adc_mag_fck>;
    am437x-l4.dtsi:                         adc {
    am437x-l4.dtsi:                                 compatible = "ti,am4372-adc";
    

    Bootlin & Linaro do good work, so I would expect that this code worked fine when it was merged into mainline Linux. However, as far as I am aware, TI has not actually validated the code on any SDK release. So please do all the validation you would do with any code where you don't know whether it will work properly on a given release.

    I am not sure what you mean by "is there any possibility that we can use ADC1 as GPIO"

    The ADC can be used to read in Analog voltage values, but it is NOT a GPIO module. Neither ADC instance was designed to read or write digital voltage values of 0 or 1.

    On Sitara processors, we often have more signals on the processor than pins on the processor, so we use "pinmuxing" to mux multiple signals to the same pin. However, all of the ADC pins are dedicated just to the ADC signals. You cannot mux an ADC pin to a GPIO module. For more information about pinmuxing, please refer to the AM437x datasheet.

    You could certainly have a processor core read in a value from either ADC instance, and then decide whether the value counts as a 0 or a 1 (e.g., I could decide that 0.3V and below are a zero, 1.5V and above are a one, and 0.3V - 1.5V is an invalid value). But that would involve writing your own custom code.

    Regards,

    Nick