eclipse / mraa

Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
http://mraa.io
MIT License
1.37k stars 613 forks source link

Query: What is the rate at which AIO read and GPIO write can be called #950

Open BinduRao2018 opened 5 years ago

BinduRao2018 commented 5 years ago

i am using mraa on Raspberry PI with Grove Kit. I see occasional failures when I use mraa_aio_read (read_status = -1) and mraa_gpio_write (status = MRAA_ERROR_UNSPECIFIED). I have several writes to GPIO and reads from AIO (various pins). All the calls are serialized and I invoke these apis continuously. I would like to know if there is any limitation w.r.t successive reads/writes using mraa. Can retry mechanism in these cases help or should i try writing to/reading from after a delay?

Mani-Sadhasivam commented 5 years ago

Hi @BinduRao2018,

IMO this behavior is the limitation of SYSFS interface for both GPIO and AIO. You can test this by writing a simple shell script which just reads from AIO (/sys/bus/iio/devices/iio:device0/in_voltage0_raw) and writes to GPIO through SYSFS. I would suggest you to provide a delay after each read/write.

BinduRao2018 commented 5 years ago

Thanks for the info @Mani-Sadhasivam. I will look into this.