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.

PROCESSOR-SDK-AM65X: ADC read using sysfs

Part Number: PROCESSOR-SDK-AM65X


Hi forum,

I'm trying to check out a board, and would like to perform simple reads from ADC0 and ADC1.  I am using SDK 06.00.00.07.

I looked at the ADC kernel driver documentation, and it seems to imply that I should be able to perform a one-shot read of any ADC channel like this:

cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw

This would, I think, read input 0 of ADC0.

However, when I do this for any channel on either ADC0 or ADC1, I am always reading 4095, even if I have the input tied to ground.

Is there something else that needs to be configured in order to enable one-shot ADC readings like this?  I do have all channels assigned to tsadc0 and tsadc1 in my device tree.

Thanks in advance for your time and help!

Scott

  • Hello Scott,

    Take a look at your board's ADC Connector. Make sure that you have 1.8V connected to ADCx_REFP and 0V connected to ADCx_REFN.

    Let us know if you have follow-up questions!

    Regards,

    Nick

  • Hi Nick,

    That is correct.  The references you mention are what is supposed to be connected to ADCx_REFP and ADCx_REFn.  It is possible that there are other hardware problems on my board.  We are expected new boards this week, and I will do a deeper dive into the references and trying to read ADC values at that time.  My current board is a bit of a mess, and I don't want to waste time debugging bad hardware.

    Could you confirm that the example I gave should do a single reading from one of the ADC channels?  Just knowing that I have the correct approach would be a huge help.  As a reminder, the example command is:

    cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw

    Please confirm that this is the right approach to taking single readings.  I don't have to worry about taking continuous or burst readings yet, which I realize require more setup to attain from the Linux SDK Driver documentation.

    Thanks for your help, and I will post back next week on attempts to read values using the better hardware platform.

    Best regards!

    Scott

  • Hello Scott,

    I just checked on my AM65x. That is the correct approach to do a single reading from one of the ADC channels.

    With nothing connected to ADC Connector, I saw 
    cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw --> 4095

    With MCU_ADC0_REFP connected to 1.8V and MCU_ADC0_REFN connected to 0V, I saw
    cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw --> 2653 (floating value)

    I then connected MCU_ADC1_CH0 to GND, and saw
    cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw --> 0

    Regards,

    Nick

  • Perfect, Nick,

    Thanks very much for your experiments and confirmation.  I should be getting my new board this week, and hope to be able to try this for myself.

    If I have any further questions, I will post back again here, but I think this answers my questions.

    Best regards!

    Scott