Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 18089

Re: ADC stops reading on 510th iteration on Python

$
0
0

I am only guessing here as I have not tried out the ADC on the edison yet, So as such have not tried it with MRAA and at best I have only tinkered a little bit with Python.....

 

So I don't know how:   print (mraa.Aio(0).read())

which is in a loop is implemented.  Does it keep around one instance of an MRAA_AIO object associated with pin A0, or does it create a MRAA object do the read and destroy it...  My guess may be the later.

 

So my guess is maybe you are running out of system resources like file handles.  I can see in the function: mraa_aio_init(unsigned int aio)

It calls the function: aio_get_valid_fp

Which opens a file handle to: "/sys/bus/iio/devices/iio:device0/in_voltage0_raw"

And I don't see anywhere where this file handle is closed.

 

again guessing, the close function should be updated to maybe something like:

 

mraa_result_t
mraa_aio_close(mraa_aio_context dev)
{    if (NULL != dev) {        if (dev->adc_in_fp != -1)            close(dev->adc_in_fp);        free(dev);    }    return(MRAA_SUCCESS);
}

Warning, I manually typed in the changes here so may have missed something syntax wise...  To try out these changes you would have to build MRAA...

Also if you have not already done so, you should raise an issue with MRAA up on github.  Project(intel-iot-devkit/mraa) under github.com


Viewing all articles
Browse latest Browse all 18089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>