I have been working on the Adafruit_BBIO.ADC library for reading high frequency vibrational data from a sensor. This requires a sampling rate of about 3kHz, and hence, the ADC.read() function is being called several thousand times a second to store this data. However, after a random amount of time, the program gets "stuck" on ADC.read_raw(). There is no value displayed on print, and the data also fails to be recorded. Even the KeyboardInterrupt (ctrl + c) doesn't succeed in terminating the operation. The program only ceases once the process has been terminated by closing the window or resetting the connection with the beagle bone. (or by logging into a different ssh session and re-running the program).
Is there any bug in the library as the webpage claims? https://learn.adafruit.com/setting-up-i ... io-library
What can be done to address this issue? is there any way to use a timeout function for the read/read_raw() methods, so that after a specific time it can be re-started when it is stuck. Do timeout functions like https://stackoverflow.com/questions/228 ... -to-finish work in resolving such issues? Since it happens after a random amount of time, it is very difficult to recreate the scenario.
What causes the program to be stuck? Is it because of the high sampling rate or because of the ADC library issues? What can be the alternatives?
I am running it on a BeagleBone Black which is running on Ubuntu Xenial. (16.04.5 LTS (Xenial Xerus))
Code: Select all
import Adafruit_BBIO.ADC as ADC
ADC.setup()
val = ADC.read_raw() # called several thousand times/ second