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.

Who knows how to read adc value in case of continuous mode?



I need to read adc value on user application.

actually, it's successful to read adc value in case of oneshot mode.

i used "open and read function" like this.

int main()

{

      int fd;

       char data[4];

       fd = open("/sys/bus/iio/devices/iio\:device0/in_voltage5_raw", O_RDONLY);

       read(fd, data, sizeof(data);

      printf("%s\n", data);

}

it's same to "cat /sys/bus/iio/devices/iio\:device0/in_voltage5_raw"

but it's about oneshot mode.

i need to do in continuous mode.

i don't know how to do.

http://processors.wiki.ti.com/index.php/AM335x_ADC_Driver's_Guide

i saw this link and followed command.

echo continuous > /sys/bus/iio/devices/iio\:device0/mode

echo 1 > /sys/bus/iio/devices/iio\:device0/scan_elements/in_voltage5_en

echo 100 > /sys/bus/iio/devices/iio\:device0/buffer/length

echo 1 > /sys/bus/iio/devices/iio\:device0/buffer/enable

but there is no way how to read adc value in case of continuous mode.

when i tried cat /sys/bus/iio/devices/iio\:device0/in_voltage5_raw, it shows error message.

could anyone help me how to read adc value??:(

i wil be waiting for answer! thanks

  • You have already a post open with this question. Please do not double-post.

  • Hi Seonghoon,

    Continuous mode is not supported in the 3.12 kernel.  I will correct the documentation.

    There was limited support for continuous mode in the 3.2 kernel which was the TI Sitara SDK 6.0 release.

    To access continuous mode, you would have to download the Sitara Linux SDK 6.0 release for AM335x. It may be added in the future, but currently there are no plans to add continuous mode back into the ADC driver.

  • Hi. I checked my kernel. i found it's Linux-3.2.0.

    As you talked, i could have read adc value in continuous mode, right?

    huh, i'm very nervous about this problem.

    After i act my program,  i want to read adc value every 10ms. but one time is only possible to read adc value in oneshot mode. in order to read adc value, i have to repeat open function and close function.

    i just want to use read function in order to read adc function after open function.

    do you know what i want to do??im so sorry. my english is bad .

    so i don't know whether i can explain to you about it exactly.

    what i want to do is just how to read adc value every 10ms by acting application which is not "cat command"