PyBBIO Analog Input: Failure to Load ADC File
When running the PyBBIO examples phant_test.py and analog_test.py, I got the following error (I believe that "may" is a typo that means "cannot"):
Traceback (most recent call last):
File "analog_test.py", line 47, in <module>
run(setup, loop)
File "/usr/lib/python2.7/site-packages/PyBBIO-0.9-py2.7-linux-armv7l.egg/bbio/bbio.py", line 63, in run
loop()
File "analog_test.py", line 37, in loop
val1 = analogRead(pot1)
File "/usr/lib/python2.7/site-packages/PyBBIO-0.9-py2.7-linux-armv7l.egg/bbio/platform/beaglebone/bone_3_8/adc.py", line 46, in analogRead
raise Exception('*Could load overlay for adc_pin: %s' % adc_pin)
Exception: *Could load overlay for adc_pin: ['/sys/devices/ocp.2/PyBBIO-AIN0.*/AIN0', 'PyBBIO-AIN0', 'P9.39']
I tried restarting BeagleBone (rev A6, working with Angstrom with kernel 3.8, no bindings) to clean up the file /sys/devices/bone_capemgr.7/slots
, but that didn't work. It seems PyBBIO is accessing the slots file and adding overlays, because the slots file looks like this after running the program:
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Override Board Name,00A0,Override Manuf,PyBBIO-ADC
5: ff:P-O-L Override Board Name,00A0,Override Manuf,PyBBIO-AIN0
Since some changes were made to the slots file, I checked what files the function was executing analog_read(adc_pin)
in the adc.py file of the PyBBIO file was extracted. With some printing statements, I figured out that the root problem was that the file /sys/devices/ocp.2/PyBBIO-AIN0.*/AIN0
that appears to store analog read values does not exist. The function glob.glob
returns a null array and ls /sys/devices/ocp.2/PyBBIO-AIN0.10/
shows it modalias power subsystem uevent
as the only content. Is there something wrong with the overlay file? Or could there be another program or problem that prevents BeagleBone from writing the file AIN0
that PyBBIO is trying to read? The python code seems to be logically correct, but the overlay is not working correctly or is blocked in some way.
source to share
No one has answered this question yet
Check out similar questions: