Adafruit_BBIO.ADC, ADC.read_raw()
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit_BBIO.ADC, ADC.read_raw()

by kag634 on Tue Aug 27, 2019 10:56 am

Hi all,

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 | TOGGLE FULL SIZE
import Adafruit_BBIO.ADC as ADC
val = ADC.read_raw() # called several thousand times/ second

Posts: 4
Joined: Wed Jun 19, 2019 2:01 pm

Re: Adafruit_BBIO.ADC, ADC.read_raw()

by silver2row on Wed Aug 28, 2019 8:59 pm


What is the entire source? https://adafruit-beaglebone-io-python.r ... t/ADC.html is what I found. I can try to recreate the issue while reading a value and printing to file if necessary.


P.S. What kernel are you using?

Posts: 180
Joined: Sat Jan 30, 2016 3:42 pm

Please be positive and constructive with your questions and comments.