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.

Linux/AM3352: ADC subsystem reset

Part Number: AM3352


Tool/software: Linux

Hi Ti team,
I'm testing ADC fucntion, and using the following command to read a single ADC output.

root@am335x-evm:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
2233
root@am335x-evm:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
2230
root@am335x-evm:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
2229
root@am335x-evm:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
2232

My question is that is there any way /method to reset ADC subsystem in normal operation ?


From Will Hsu

  • Hi Champs:

       Please allow me to explain this issue.

       Customer  is willing to disable / enable the ADC from the  user space.

       And now, we found this command is able to fit this request.

       ==>

    Command to disable ADC: devmem2 0x44E0D040 w 0x00000016 (0b0001 0110)

    Command to enable ADC: devmem2 0x44E0D040 w 0x00000007 (0b0000 0111)

      

       Customer is willing to know from TI about more ADC information, so,  

       Please provide the formal ADC initial steps from SW/HW perspective  (without issue and side effect) for us..

    THanks.

       BR Rio

  • Rio Chan said:
    Please provide the formal ADC initial steps from SW/HW perspective  (without issue and side effect) for us..

    What exactly do you mean? In Linux the driver takes care of the ADC initialization. See

    Other useful ADC resources can be found here:

  • Will and Rio,

    The touchscreen driver and the ADC driver in the Linux use case share the same hardware (TSC_ADC). For that reason, an MFD (multi-function device) driver was made to arbitrate the accesses from the two drivers to the shared hardware. 

    MFD driver - drivers/mfd/ti_am335x_tscadc.c

    ADC driver - drivers/iio/adc/ti_am335x_adc.c

    Touchscreen driver - drivers/input/touchscreen/ti_am335x_tsc.c

    To see the initial steps that Linux uses to configure the ADC peripheral, please see the probe functions in the drivers mentioned above (ti_tscadc_probe, tiadc_probe, and titsc_probe). You'll notice that the tscadc_writel, tiadc_writel, and titsc_writel functions are all writing to the same registers that you can access from user space using the devmem2 utility.

    The register descriptions for the ADC are provided in section 12.5 of the AM335x TRM (http://www.ti.com/lit/pdf/spruh73).

    Jason Reeder

    PS. There is a section of the code in the drivers/iio/adc/ti_am335x_adc.c file in the tiadc_irq_h() function that shows the ADC being disabled/enabled in order to recover from a FIFO overrun. That code basically does the same thing that you are doing with devmem2 except only bit 0 of the CTRL register is toggled (bit 4 is not toggled in that function).